TanvirArjel.EFCore.GenericRepository 3.0.2

There is a newer version of this package available.
See the version list below for details.
Install-Package TanvirArjel.EFCore.GenericRepository -Version 3.0.2
dotnet add package TanvirArjel.EFCore.GenericRepository --version 3.0.2
<PackageReference Include="TanvirArjel.EFCore.GenericRepository" Version="3.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TanvirArjel.EFCore.GenericRepository --version 3.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TanvirArjel.EFCore.GenericRepository, 3.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install TanvirArjel.EFCore.GenericRepository as a Cake Addin
#addin nuget:?package=TanvirArjel.EFCore.GenericRepository&version=3.0.2

// Install TanvirArjel.EFCore.GenericRepository as a Cake Tool
#tool nuget:?package=TanvirArjel.EFCore.GenericRepository&version=3.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

How do I get started?

First, install the appropriate version of this NuGet package into your project as follows:

**For EF Core 2.x.x πŸ˜—*

Install-Package TanvirArjel.EFCore.GenericRepository -Version 2.0.2

**For EF Core 3.0.x πŸ˜—*

Install-Package TanvirArjel.EFCore.GenericRepository -Version 3.0.2

**For EF Core >= 3.1.x πŸ˜—*

Install-Package TanvirArjel.EFCore.GenericRepository -Version 3.1.2

Then in the ConfirugeServices method of the Startup class:

public void ConfigureServices(IServiceCollection services)
{
    string connectionString = Configuration.GetConnectionString("RepositoryDbConnection");
    services.AddDbContext<DemoDbContext>(option => option.UseSqlServer(connectionString));

    services.AddGenericRepository<DemoDbContext>(); // Call it just after registering your DbConext.
}

Usage:

Now inject IUnitOfWork interface in your relevant class constructor and use as follows:

public class EmployeeService
{
   private readonly IRepository _repository;

   public EmployeeService(IRepository repository)
   {
      _repository = repository;
   }
 
   public async Task<Employee> GetEmployeeAsync(int employeeId)
   {
      Employee employee = await _repository.GetEntityByIdAsync<Employee>(1);
      return employee;
   }
}

To see more details documentation, please visit GitHub Repository

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
5.8.0 354 11/12/2021
5.7.0 455 10/6/2021
5.6.0 372 8/13/2021
5.5.0 2,434 4/7/2021
5.4.0 110 3/30/2021
5.3.0 230 3/27/2021
5.2.2 419 2/12/2021
5.2.1 139 2/8/2021
5.2.0 103 2/7/2021
5.1.0 214 1/14/2021
5.0.0 357 11/12/2020
3.1.2 822 5/20/2020
3.1.1 258 4/25/2020
3.1.0 247 4/23/2020
3.0.2 268 5/20/2020
3.0.1 238 4/25/2020
3.0.0 249 4/23/2020
2.0.2 250 5/20/2020
2.0.1 225 4/25/2020
2.0.0 211 4/23/2020

1. This release added support of generic repository through generic methods for more simplicity.