EF.Core.Generic.Data
3.0.0
dotnet add package EF.Core.Generic.Data --version 3.0.0
NuGet\Install-Package EF.Core.Generic.Data -Version 3.0.0
<PackageReference Include="EF.Core.Generic.Data" Version="3.0.0" />
paket add EF.Core.Generic.Data --version 3.0.0
#r "nuget: EF.Core.Generic.Data, 3.0.0"
// Install EF.Core.Generic.Data as a Cake Addin #addin nuget:?package=EF.Core.Generic.Data&version=3.0.0 // Install EF.Core.Generic.Data as a Cake Tool #tool nuget:?package=EF.Core.Generic.Data&version=3.0.0
Generic Repository Pattern for C# .Net Core
Easy to use generic Repository and Unit of Work pattern for Entity Framework .NET Core.
Installation
The easiest way to install EF.Core.Generic.Data into your solution/project is to use NuGet.:
nuget Install-Package EF.Core.Generic.Data
Or via the DotNet Cli
dotnet add package EF.Core.Generic.Data
Check out Nuget package page for more details.
Bugs & Feature requests
If you want to raise bugs or Request a feature please do so via a Github issue and we will attempt to address it as soon as resource is available to do so.
Documentation
Once you have added the Nuget Package to your project, you can edit your Startup.cs
and import using EF.Core.Generic.Data.DependencyInjection;
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
// Use the EF.Core.Generic.Data Dependency Injection to set up the Unit of Work
services.AddDbContext<SampleContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("NAME OF CONNECTION")))
.AddUnitOfWork<SampleContext>();
services.AddMvc();
}
}
Example
Below is an example of a simple select.
public class PersonService : IService<Person>
{
private readonly IUnitOfWork _db;
public PersonService(IUnitOfWork db)
{
_db = db;
}
public Person GetAddressint id)
{
return _db.Repository<Person>().Get(id);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Microsoft.EntityFrameworkCore (>= 7.0.13)
- Microsoft.EntityFrameworkCore.AutoHistory (>= 6.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.13)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Add ability to get the current db connection string.