MasterNeverDown.GenericsRepository 1.0.1

dotnet add package MasterNeverDown.GenericsRepository --version 1.0.1                
NuGet\Install-Package MasterNeverDown.GenericsRepository -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="MasterNeverDown.GenericsRepository" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MasterNeverDown.GenericsRepository --version 1.0.1                
#r "nuget: MasterNeverDown.GenericsRepository, 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 MasterNeverDown.GenericsRepository as a Cake Addin
#addin nuget:?package=MasterNeverDown.GenericsRepository&version=1.0.1

// Install MasterNeverDown.GenericsRepository as a Cake Tool
#tool nuget:?package=MasterNeverDown.GenericsRepository&version=1.0.1                

CommunityToolkit.GenericsRepository

CommunityToolkit.GenericsRepository is a .NET library that provides a generic repository pattern implementation using Entity Framework Core. This library simplifies data access by providing a set of generic methods for common CRUD operations.

Features

  • Generic repository pattern implementation
  • Supports Entity Framework Core
  • In-memory database support for testing
  • Asynchronous methods for CRUD operations

Installation

You can install the package via NuGet Package Manager:

dotnet add package CommunityToolkit.GenericsRepository --version 1.0.0

Usage

Setting up the DbContext First, create a DbContext class that inherits from GenericDbContext<T>:

Using the Repository

You can now use the repository in your application:

Creating the Repository

Next, create a repository class that inherits from Repository<T>:


var options = new DbContextOptionsBuilder<DbContext>()
    .UseInMemoryDatabase(databaseName: "TestDatabase")
    .Options;
var context = new GenericDbContext<TestEntity>(options);
var repository = new Repository<TestEntity>(context);

var entity = new TestEntity { Id = 1, Name = "Test" };
await repository.AddAsync(entity);

var result = await repository.GetByIdAsync(1);
Console.WriteLine(result.Name); // Output: Test

License

This project is licensed under the MIT License. See the LICENSE file for more details.

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 was computed.  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. 
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
1.0.1 103 10/28/2024