From 5adbdf5a2300c682803cb4b5d19ccf75c62b60d5 Mon Sep 17 00:00:00 2001 From: radioActive DROID Date: Sat, 13 Jan 2024 02:29:59 +0100 Subject: [PATCH] minor documentation update --- README.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bd81924..73bb563 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ A personal shared library for various types of dotnet project types +NOTE: Issues can be created to improve documentation and fix errors ### Sub-packages @@ -13,8 +14,6 @@ Axolotl.EFCore: Axolotl.Razor: -Axolotl.Maui: - # Install @@ -34,7 +33,6 @@ Install-Package Axolotl.Http Install-Package Axolotl.EFCore Install-Package Axolotl.AspNet Install-Package Axolotl.Razor -Install-Package Axolotl.Maui ``` ## Asp.Net Core Samples @@ -69,10 +67,27 @@ public class ServiceContext : DbContext { } ``` +### Create your generic repository and apply DbContext + +```csharp +public class GenericRepository : GenericBaseRepository + where TEntity : class, IAggregateRoot, IHasKey + where TKey : notnull { + public GenericRepository(ServiceContext context) : base(context) { } +} +``` + +### Register generic repository + +```csharp +builder.Services.RegisterGenericRepositories(typeof(GenericRepository<,>)); +builder.Services.RegisterGenericServices(); +``` + ### Create optional filter specification ```csharp -public sealed class CategorySpec : Specification { +public sealed class CategorySpec : Specification { public CategorySpec(IPageFilter filter) { var search = filter.Search ?? string.Empty; var text = search.ToLower().Split(" ").ToList().Select(x => x); @@ -86,7 +101,7 @@ public sealed class CategorySpec : Specification { ### Create feature/endpoint ```csharp -public class CategoryFeature : GenericFeature { +public class CategoryFeature : GenericFeature { public override IEndpointRouteBuilder MapEndpoints(IEndpointRouteBuilder endpoints) { var state = new FeatureState(new List { new (RouteType.GetAll, typeof(CategorySpec)),