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                
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="EF.Core.Generic.Data" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EF.Core.Generic.Data --version 3.0.0                
#r "nuget: EF.Core.Generic.Data, 3.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.
// 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 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. 
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
3.0.0 348 11/5/2023
2.0.2 410 9/27/2021
2.0.1 522 9/11/2020
2.0.0 468 8/10/2020

Add ability to get the current db connection string.