CleanCodeJN.Repository.EntityFramework 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package CleanCodeJN.Repository.EntityFramework --version 1.0.1                
NuGet\Install-Package CleanCodeJN.Repository.EntityFramework -Version 1.0.1                
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="CleanCodeJN.Repository.EntityFramework" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CleanCodeJN.Repository.EntityFramework --version 1.0.1                
#r "nuget: CleanCodeJN.Repository.EntityFramework, 1.0.1"                
#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.
// Install CleanCodeJN.Repository.EntityFramework as a Cake Addin
#addin nuget:?package=CleanCodeJN.Repository.EntityFramework&version=1.0.1

// Install CleanCodeJN.Repository.EntityFramework as a Cake Tool
#tool nuget:?package=CleanCodeJN.Repository.EntityFramework&version=1.0.1                

Generic Repository Implementation

Repository Abstraction for Entity Framework

This generic Repository implementation for Entity Framework abstracts completely all EF-References from your business layer in a domain driven design manner.

Features

  • Ready to use in seconds
  • Abstracts all EF specific Code out of your business layer
  • Easy to mock and test
  • On latest .NET 8.0

How to use

  • Add IEntity<T> interfaces to your domain classes
  • Add IDataContext Interface to your DBContext class
  • Use Extension RegisterRepositories() in your startup class or program.cs
  • Inject IRepository<T> in your business layer
  • Just use It

Step by step explanation

Add IEntity<T> interfaces to your domain classes:

public class Comment : IEntity<int>
{
    public int Id { get; set; }
}

Add IDataContext Interface to your DBContext class:

public partial class YourContext : DbContext, IDataContext
{   
}

Use Extension RegisterRepositories() in your startup class or program.cs:

using CleanCodeJN.Repository.EntityFramework.Extensions;
using Microsoft.Extensions.Hosting;

var builder = Host.CreateApplicationBuilder(args);

// Register Repositories
builder.Services.RegisterRepositories();

await builder.Build().RunAsync();

Inject IRepository<T> in your business layer:

public class MyService(IIntRepository<Customer> repository)
{   
}

Just use it:

List<customer> customerWhoHavePayed = repository.Query(x => x.Invoices).Where(x => x.Invoice.IsPayed).ToList()

License

MIT

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. 
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 CleanCodeJN.Repository.EntityFramework:

Package Downloads
CleanCodeJN.GenericApis

This CleanCodeJN package streamlines the development of web APIs in .NET applications by providing a robust framework for CRUD operations and facilitating the implementation of complex business logic in a clean and maintainable manner.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.6 242 10/8/2024
1.1.5 78 9/25/2024
1.1.4 167 9/12/2024
1.1.3 329 5/7/2024
1.1.2 122 5/7/2024
1.1.1 169 5/2/2024
1.1.0 93 5/2/2024
1.0.2 94 5/1/2024
1.0.1 100 5/1/2024
1.0.0 104 5/1/2024

Bug Fixes