YDotNet.Repository 1.0.1

dotnet add package YDotNet.Repository --version 1.0.1
                    
NuGet\Install-Package YDotNet.Repository -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="YDotNet.Repository" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YDotNet.Repository" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="YDotNet.Repository" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add YDotNet.Repository --version 1.0.1
                    
#r "nuget: YDotNet.Repository, 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.
#addin nuget:?package=YDotNet.Repository&version=1.0.1
                    
Install YDotNet.Repository as a Cake Addin
#tool nuget:?package=YDotNet.Repository&version=1.0.1
                    
Install YDotNet.Repository as a Cake Tool

🚀 Generic Repository Pattern

This project provides a generic repository pattern implementation for .NET applications using Entity Framework Core. Inspired by Java Spring's repository approach, this abstraction layer helps separate business logic from data access logic, making your application more maintainable, scalable, and testable.

✨ Features

✅ Generic repository that works with any entity type
Async/await support for improved performance
CRUD operations (Create, Read, Update, Delete)
Type-safe operations with generic type parameters
✅ Built on top of Entity Framework Core

📦 Installation

🚧 Coming soon (NuGet package setup in progress)

📌 Usage

1️⃣ Define Your Entity

Your entity class must implement the IEntity interface:

public class YourEntity : IEntity
{
    public int Id { get; set; }
    // ... other properties
}

2️⃣ Create a Repository

Create a specific repository for your entity by inheriting from the base Repository class:

public class YourEntityRepository : Repository<YourEntity, int>
{
    public YourEntityRepository(DbContext context) : base(context)
    {
    }
}

3️⃣ Use the Repository

// In your service or controller:
public class YourService
{
    private readonly YourEntityRepository _repository;

    public YourService(YourEntityRepository repository)
    {
        _repository = repository;
    }

    public async Task<YourEntity?> GetEntityById(int id)
    {
        return await _repository.GetByIdAsync(id);
    }

    public async Task<IEnumerable<YourEntity>> GetAllEntities()
    {
        return await _repository.GetAllAsync();
    }
}

🔧 Available Methods

  • GetByIdAsync(TIdentifier id): 🔍 Retrieves an entity by its ID
  • Add(TEntity entity): ➕ Adds a new entity
  • Update(TEntity entity): 🔄 Updates an existing entity
  • Delete(TEntity entity): 🗑️ Removes an entity
  • GetAllAsync(): 📜 Retrieves all entities

📌 Dependencies

  • Microsoft.EntityFrameworkCore

🤝 Contributing

Contributions are welcome! 🎉 Feel free to submit issues, bug fixes, or feature requests.

📜 License

📝 MIT License – Free to use and modify!


This version makes the README more engaging while keeping it professional and informative. Let me know if you’d like any additional tweaks! 🚀😊

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 178 3/8/2025
1.0.0 178 3/8/2025