LogicBuilder.EntityFrameworkCore.SqlServer 7.2.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package LogicBuilder.EntityFrameworkCore.SqlServer --version 7.2.0
                    
NuGet\Install-Package LogicBuilder.EntityFrameworkCore.SqlServer -Version 7.2.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="LogicBuilder.EntityFrameworkCore.SqlServer" Version="7.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LogicBuilder.EntityFrameworkCore.SqlServer" Version="7.2.0" />
                    
Directory.Packages.props
<PackageReference Include="LogicBuilder.EntityFrameworkCore.SqlServer" />
                    
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 LogicBuilder.EntityFrameworkCore.SqlServer --version 7.2.0
                    
#r "nuget: LogicBuilder.EntityFrameworkCore.SqlServer, 7.2.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 LogicBuilder.EntityFrameworkCore.SqlServer@7.2.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=LogicBuilder.EntityFrameworkCore.SqlServer&version=7.2.0
                    
Install as a Cake Addin
#tool nuget:?package=LogicBuilder.EntityFrameworkCore.SqlServer&version=7.2.0
                    
Install as a Cake Tool

LogicBuilder.EntityFrameworkCore.SqlServer

A repository pattern library for Entity Framework Core that provides seamless mapping between business models and data entities, with advanced expression translation capabilities.

Features

  • Two-Way Object Mapping: Automatically maps business model objects to and from data entities using AutoMapper
  • Expression Translation: Translates LINQ query expressions from business model to data model, enabling queries to be written against your business layer
  • Repository Pattern: Implements a clean repository pattern with IContextRepository and ContextRepositoryBase
  • Store Layer: Provides IStore and StoreBase for direct DbContext operations
  • Advanced Querying: Supports complex operations including:
    • Filtering with Expression<Func<TModel, bool>>
    • Sorting and pagination
    • Grouping and aggregations
    • Select/expand operations
    • Include navigation properties
  • CRUD Operations: Full support for Create, Read, Update, Delete operations
  • Graph Operations: Save entire object graphs with SaveGraphAsync and SaveGraphsAsync
  • Change Tracking: Methods to manage EF Core change tracker (AddChanges, ClearChangeTracker, DetachAllEntries)
  • Batch Operations: Support for batch saves and deletes

Installation

dotnet add package LogicBuilder.EntityFrameworkCore.SqlServer

Usage

    //Create a context
    public class SchoolContext : DbContext
    {
        public SchoolContext(DbContextOptions<SchoolContext> options) : base(options)
        {
        }
    }

    //Create Store
    public interface ISchoolStore : IStore
    {
    }
    public class SchoolStore : StoreBase, ISchoolStore
    {
        public SchoolStore(SchoolContext context)
            : base(context)
        {
        }
    }

    //Create Repository
    public interface ISchoolRepository : IContextRepository
    {
    }
    public class SchoolRepository : ContextRepositoryBase, ISchoolRepository
    {
        public SchoolRepository(ISchoolStore store, IMapper mapper) : base(store, mapper)
        {
        }
    }

    //Register Services including AutoMapper profiles.
    IServiceProvider serviceProvider = new ServiceCollection()
                .AddDbContext<SchoolContext>
                (
                    options =>
                    {
                        options.UseInMemoryDatabase("ContosoUniversity");
                        options.UseInternalServiceProvider(new ServiceCollection().AddEntityFrameworkInMemoryDatabase().BuildServiceProvider());
                    }
                )
                .AddTransient<ISchoolStore, SchoolStore>()
                .AddTransient<ISchoolRepository, SchoolRepository>()
                .AddSingleton<AutoMapper.IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddProfiles(typeof(SchoolProfile).GetTypeInfo().Assembly)))
                .AddTransient<IMapper>(sp => new Mapper(sp.GetRequiredService<AutoMapper.IConfigurationProvider>(), sp.GetService))
                .BuildServiceProvider();

    //Call the repository (inside an async method)
    ISchoolRepository repository = serviceProvider.GetRequiredService<ISchoolRepository>();
    ICollection<StudentModel> list = await repository.GetAsync<StudentModel, Student>();

Key Interfaces

IContextRepository

Provides methods for:

  • GetAsync<TModel, TData> - Retrieve entities with optional filtering and querying
  • CountAsync<TModel, TData> - Count entities matching a filter
  • QueryAsync<TModel, TData, TModelReturn, TDataReturn> - Execute complex queries with expression translation
  • SaveAsync<TModel, TData> - Save single or multiple entities
  • SaveGraphAsync<TModel, TData> - Save entity graphs
  • DeleteAsync<TModel, TData> - Delete entities by filter
  • AddChanges<TModel, TData> - Stage changes without saving
  • SaveChangesAsync - Persist all staged changes
  • ClearChangeTracker / DetachAllEntries - Manage change tracking

Requirements

  • .NET 8.0 or higher
  • Entity Framework Core
  • AutoMapper with expression mapping support
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 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.2.1 38 3/24/2026
7.2.0 32 3/24/2026
7.1.0 310 1/12/2026
7.0.0 379 11/25/2024
6.0.3 221 11/3/2024
6.0.2 285 8/11/2024
6.0.1 262 3/28/2024
6.0.0 404 12/27/2023
5.0.12 368 10/14/2023
5.0.11 184 10/14/2023
5.0.10 357 8/15/2023
5.0.9 377 7/16/2023
5.0.8 557 5/10/2023
5.0.7 846 10/1/2022
5.0.6 1,661 6/16/2022
5.0.4 818 4/15/2022
5.0.3 768 4/15/2022
5.0.2 546 12/24/2021
5.0.1 602 12/14/2021
5.0.0 503 12/14/2021
Loading failed

Marking unused methods obsolete.