Gholi 1.2.39
dotnet add package Gholi --version 1.2.39
NuGet\Install-Package Gholi -Version 1.2.39
<PackageReference Include="Gholi" Version="1.2.39" />
<PackageVersion Include="Gholi" Version="1.2.39" />
<PackageReference Include="Gholi" />
paket add Gholi --version 1.2.39
#r "nuget: Gholi, 1.2.39"
#:package Gholi@1.2.39
#addin nuget:?package=Gholi&version=1.2.39
#tool nuget:?package=Gholi&version=1.2.39
๐ฆ Gholi โ Generic Repository for EF Core(Use Latest Version) Gholi is a lightweight and practical library for building generic repositories using Entity Framework Core. It helps you manage database operations without repeating boilerplate code for CRUD actions.
โจ Features Full CRUD support (Create, Read, Update, Delete)
Filtering with Expression<Func<TEntity, bool>>
Based on Repository Pattern and Separation of Concerns
Flexible and reusable in any EF Core-based project
Built-in Soft Delete support
Easy to use โ no need to write repository classes per entity
๐ Project Structure Copy Edit ๐ฆ Gholi/ โฃ ๐ Services/ โ โฃ ๐ IGholiCommandService.cs โ โฃ ๐ IGholiQueryService.cs โ โฃ ๐ GholiCommandService.cs โ โ ๐ GholiQueryService.cs โฃ ๐ Extensions.cs โ ๐ Gholi.csproj โ Usage
Installation (if published as a NuGet package) bash Copy Edit dotnet add package Gholi
Define your DbContext and Entity csharp Copy Edit public class Car { public long Id { get; set; } public string CarName { get; set; } public bool IsDeleted { get; set; } }
Register services in Program.cs or Startup.cs csharp Copy Edit services.AddScoped(typeof(IGholiCommandService<,,>), typeof(GholiCommandService<,,>)); services.AddScoped(typeof(IGholiQueryService<,,>), typeof(GholiQueryService<,,>));
Use in a controller csharp Copy Edit public class TestController : Controller { private readonly IGholiCommandService<TestDbContext, Car, long> _command; private readonly IGholiQueryService<TestDbContext, Car, long> _query;
public TestController( IGholiCommandService<TestDbContext, Car, long> command, IGholiQueryService<TestDbContext, Car, long> query) { _command = command; _query = query; }
public async Task<IActionResult> Index() { var cars = await _query.FilterAsync(c โ c.CarName.StartsWith("mazda")); return View(cars); }
public async Task<IActionResult> Create() { var newCar = new Car { CarName = "mazda" }; await _command.CreateOneAsync(newCar); return RedirectToAction("Index"); } } โ Available Methods IGholiQueryService: GetAllAsync()
FindByIdAsync(id)
FilterAsync(Expression<Func<TEntity, bool>> predicate)
AnyAsync(predicate)
CountAsync(predicate)
IGholiCommandService: CreateOneAsync(entity)
CreateManyAsync(entities)
UpdateAsync(entity)
DeleteAsync(id) (Soft delete)
DeleteManyAsync(predicate) (Soft delete)
RestoreAsync(id) (Restores soft-deleted record)
๐ Notes All delete operations use Soft Delete (IsDeleted = true).
FilterAsync() excludes soft-deleted items by default.
Your entity must have a bool IsDeleted property for compatibility.
๐งช Testing You can easily unit test GholiCommandService and GholiQueryService using frameworks like xUnit or NUnit, as they're fully mockable.
๐ License This project is licensed under the MIT License. You are free to use it for personal or commercial projects.
๐ง Author Developed by: Shayan Khalaj
Email: ShayanKhalaj90@gmail.com
GitHub:
Product | Versions 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.EntityFrameworkCore (>= 8.0.16)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.16)
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.2.39 | 257 | 6/9/2025 | |
1.1.40 | 244 | 6/9/2025 | |
1.0.23 | 448 | 6/9/2025 | |
1.0.22 | 417 | 6/9/2025 | |
1.0.21 | 418 | 6/9/2025 | |
1.0.20 | 420 | 6/9/2025 | |
1.0.19 | 419 | 6/9/2025 | |
1.0.18 | 424 | 6/9/2025 | |
1.0.17 | 426 | 6/9/2025 | |
1.0.16 | 417 | 6/9/2025 | |
1.0.12 | 291 | 6/7/2025 | |
1.0.11 | 280 | 6/7/2025 | |
1.0.10 | 289 | 6/7/2025 | |
1.0.9 | 274 | 6/7/2025 | |
1.0.8 | 353 | 6/3/2025 | |
1.0.7 | 362 | 6/3/2025 | |
1.0.6 | 362 | 6/3/2025 | |
1.0.5 | 361 | 6/3/2025 | |
1.0.4 | 356 | 6/3/2025 | |
1.0.3 | 359 | 6/3/2025 | |
1.0.2 | 358 | 6/3/2025 | |
1.0.1 | 358 | 6/3/2025 | |
1.0.0 | 362 | 6/3/2025 |