Buzruk.GenericRepository 1.8.0

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

// Install Buzruk.GenericRepository as a Cake Tool
#tool nuget:?package=Buzruk.GenericRepository&version=1.8.0

<p align="center"> <img src="https://github.com/buzurgmexrubon/Buzruk.GenericRepository/blob/master/icon.png" height="128"> <h1 align="center">Buzruk.GenericRepository</h1> </p>

The Future of .NET Data Access is Here!

Say goodbye to repetitive CRUD boilerplate and hello to a streamlined, asynchronous-first approach to data access in your .NET applications! Buzruk.GenericRepository is your supercharged generic repository, offering a unified interface to work with various entities. Focus on building amazing features while this package handles the data interaction heavy lifting.

License MIT

Table of Contents

Overview

This generic repository simplifies data access in .NET applications by offering a unified interface for working with various entity types. It supports both synchronous and asynchronous methods, providing you with flexibility based on your application's requirements. By using this repository, you can focus on business logic and reduce boilerplate code related to data interactions.

Features

Unleash the Power of Asynchronous Excellence

  • Asynchronous by Default: Embrace the power of asynchronous methods for non-blocking, efficient data retrieval and manipulation. Free your UI threads from unnecessary waits! ⚡️
  • Synchronous Options: Maintain compatibility with legacy code or specific use cases with the included synchronous counterparts. Versatility at your fingertips!
  • Effortless Bulk Operations (Asynchronous): Optimize performance with AddRangeAsync and UpdateRangeAsync to add or update multiple entities efficiently. Save processing power for what matters. ⚡️

Intuitive Data Management

  • Essential CRUD Operations: Perform Create, Read, Update, and Delete (CRUD) actions with ease using methods like GetAsync, GetPagedAsync, AddAsync, AddRangeAsync, UpdateAsync, UpdateRangeAsync, RemoveAsync, and RemoveRangeAsync. Simplify complex data management.
  • Flexible Retrieval: Find specific entities by ID or filter them based on your criteria using the versatile GetAsync method. Get exactly the data you need, when you need it.
  • Paged Data Fetching (Asynchronous): Handle large datasets gracefully with GetPagedAsync. Retrieve data in manageable chunks, ideal for pagination and performance optimization. No more overwhelming data loads! ⚖️
  • Existence Checks: Quickly confirm entity existence with ExistsAsync to make informed decisions in your code. Avoid unnecessary database calls.
  • Efficient Counting: Get the total number of entities (CountAsync) or utilize LongCountAsync for accurate counts even with very large datasets. Always have a clear picture of your data.
  • Targeted Counting (Asynchronous): Count entities based on specific conditions with CountByAsync. Gain deeper insights into your data distribution.
  • Effortless Integration with Entity Framework Core: Designed to work seamlessly with Entity Framework Core, allowing you to leverage its powerful features. No need to reinvent the wheel!

Beyond the Basics

  • Eager Loading (Optional): Boost performance by pre-fetching related entities when retrieving primary data (asynchronous option available: EagerLoadAsync), minimizing subsequent database calls. Reduce roundtrips and improve responsiveness.
  • Change Tracking (Optional): Track entity modifications for efficient saving updates (requires configuration). Maintain data consistency with minimal effort.

A Collaborative Future

  • Expanding Horizons: Community contributions are welcome to broaden support for additional data access providers beyond Entity Framework Core! Let's make this a truly universal solution!
  • Testing Excellence: We're continuously striving to enhance unit testing coverage for unmatched reliability. Confidence in your data access layer is key!
  • Empowering Documentation: Expect even more detailed examples, tutorials, and guides to make you a data access pro! Become a master with comprehensive learning resources.

Get Started in a Flash!

Installation

  • Installation: Integrate the magic of this package into your project using NuGet:
dotnet add package Buzruk.GenericRepository

Usage Example

  • Namespace Reference: Import the namespace to access the repository's power in your code:
using Buzruk.GenericRepository
  • Activate Your Data Access Superpowers!: Create an instance of the repository and unleash its methods on your data:
// Example usage (assuming Entity Framework Core context named 'dbContext')
var repository = new GenericRepository<Product>(dbContext);

var product = await repository.GetAsync(1); // Retrieve product by ID
if (product != null)
{
    product.Name = "Updated Product Name";
    await repository.UpdateAsync(product); // Update the product
}

var products = await repository.GetPagedAsync(pageNumber: 2, pageSize: 10); // Retrieve products in a paged format

// ... (other methods usage)

Dive Deeper!

Explore our comprehensive Wiki for in-depth guidance on usage examples, configuration options, and advanced features:

Link to GitHub Wiki

Contributing

We welcome contributions to improve this repository! Here's how you can contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Implement your changes and write unit tests for them.
  4. Submit a well-documented pull request.

For more detailed guidelines, please refer to our CONTRIBUTING.md file:

Link to CONTRIBUTING.md file

Changelogs

We maintain a detailed changelog of changes made to the package in the CHANGELOG.md file:

Link to CHANGELOG.md file

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

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.8.0 71 5/10/2024
1.7.0 64 5/10/2024
1.6.0 63 5/10/2024
1.5.0 64 5/10/2024
1.4.0 126 5/9/2024
1.3.0 68 5/9/2024
1.2.0 86 5/8/2024
1.1.0 73 5/8/2024
1.0.0 78 4/29/2024

Embrace the Future of Data Access (v1.0.0 - Initial Release)