Axolotl.EFCore 9.0.0

dotnet add package Axolotl.EFCore --version 9.0.0
                    
NuGet\Install-Package Axolotl.EFCore -Version 9.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Axolotl.EFCore" Version="9.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Axolotl.EFCore" Version="9.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Axolotl.EFCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Axolotl.EFCore --version 9.0.0
                    
#r "nuget: Axolotl.EFCore, 9.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Axolotl.EFCore@9.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Axolotl.EFCore&version=9.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Axolotl.EFCore&version=9.0.0
                    
Install as a Cake Tool

Axolotl

A personal shared library for various types of dotnet project types

NOTE: Issues can be created to improve documentation and fix errors

Sub-packages

  • Axolotl:
  • Axolotl.Http:
  • Axolotl.EFCore:
  • Axolotl.Razor:

Install

The framework is provided as a set of NuGet packages. In many cases you'll only need the base package, but if you need efcore or razor there are implementation-specific packages available to assist.

To install the minimum requirements:

Install-Package Axolotl

Asp.Net Core Samples

Added required packages

Install-Package Axolotl
Install-Package Axolotl.EFCore
Install-Package Axolotl.AspNet

Add sample entity

public sealed class Post : AuditableEntity<Guid> {
    public string Title { get; set; } = null!;
    public Category Category { get; set; } = null!;
    public ICollection<Tag> Tags { get; set; } = null!;
}

Create your DB context

public class ServiceContext : DbContext {
    public ServiceContext(DbContextOptions<ServiceContext> options) : base(options) { }
    protected override void OnModelCreating(ModelBuilder modelBuilder) { }
    
    public virtual DbSet<Post> Posts { get; set; } = null!;
    
}

Create your generic repository and apply DbContext

public class GenericRepository<TEntity, TKey> : GenericBaseRepository<TEntity, ServiceContext, TKey> 
    where TEntity : class, IAggregateRoot, IHasKey<TKey> 
    where TKey : notnull {
    public GenericRepository(ServiceContext context) : base(context) { }
}

Register your DB context & Unit of work

builder.Services.AddDbContext<ServiceContext>(options => options.UseSqlite());
builder.Services.RegisterUnitOfWork<ServiceContext>(pooled: false);

Register generic repository & service

builder.Services.RegisterGenericRepositories(typeof(GenericRepository<,>));
builder.Services.RegisterGenericServices();

Create optional filter specification

public sealed class CategorySpec : Specification<Post, Guid> {
    public CategorySpec(IPageFilter filter) {
        var search = filter.Search ?? string.Empty;
        var text = search.ToLower().Split(" ").ToList().Select(x => x);
        Query.Where(x =>  x.Title != String.Empty && x.Title.Length > 3 && text.Any(p => EF.Functions.Like(x.Title.ToLower(), $"%" + p + "%")))
            .AsNoTracking()
            .OrderBy(b => b.Title);
    }
}

Create feature/endpoint

public class CategoryFeature : GenericFeature<CategoryFeature, Guid> {
    public override IEndpointRouteBuilder MapEndpoints(IEndpointRouteBuilder endpoints) {
        var state = new FeatureState(new List<RouteState> {
            new (RouteType.GetAll, typeof(CategorySpec)),
            new (RouteType.GetById),
            new (RouteType.Create)
        });

        return SetupGroup<CategoryFeature, Category, Guid>(endpoints, state);
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Axolotl.EFCore:

Package Downloads
Axolotl.AspNet

Classes and extensions to help simplify using ASP.NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.0 232 12/11/2024
8.0.5 395 1/22/2024
8.0.2 227 1/22/2024
8.0.1 246 1/13/2024
8.0.0 332 11/22/2023
8.0.0-rc.1 151 11/16/2023
8.0.0-preview.20 166 10/3/2023
8.0.0-preview.19 241 7/6/2023
8.0.0-preview.18 232 6/6/2023
8.0.0-preview.17 213 6/6/2023
8.0.0-preview.16 213 6/6/2023
8.0.0-preview.14 207 6/6/2023
8.0.0-preview.13 214 6/6/2023
8.0.0-preview.12 214 6/6/2023
8.0.0-preview.11 200 6/5/2023