ef.qore.BaseQuc
1.0.22
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ef.qore.BaseQuc --version 1.0.22
NuGet\Install-Package ef.qore.BaseQuc -Version 1.0.22
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.qore.BaseQuc" Version="1.0.22" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ef.qore.BaseQuc" Version="1.0.22" />
<PackageReference Include="ef.qore.BaseQuc" />
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 ef.qore.BaseQuc --version 1.0.22
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ef.qore.BaseQuc, 1.0.22"
#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.
#:package ef.qore.BaseQuc@1.0.22
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ef.qore.BaseQuc&version=1.0.22
#tool nuget:?package=ef.qore.BaseQuc&version=1.0.22
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
# BaseQuc Consumer Guide
A lightweight .NET Core framework for CRUD, caching, audit-trail, and message-broker integration.
This guide shows how to **install**, **configure**, and **consume** BaseQuc in the own microservice.
---
## Prerequisites
- [.NET 8.0 SDK+](https://dotnet.microsoft.com/download)
- A relational database (e.g. PostgreSQL, SQL Server, MySQL)
- (Optional) Redis for caching
- (Optional) Kafka (or other MQ) for events
---
## 1. Install NuGet Packages
```bash
dotnet add package ef.qore.basequc --version 1.0.20
dotnet add package Microsoft.EntityFrameworkCore
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package StackExchange.Redis
dotnet add package Confluent.Kafka
2. appsettings.json
{
"ConnectionStrings": {
"MasterConnection": "<YOUR_DB_CONN>",
"SlaveConnection" : "<YOUR_DB_CONN>",
"Redis" : "redis:6379"
},
"CacheSettings": {
"Enabled": true,
"Provider": "Redis",
"DefaultExpiryMinutes": 30
},
"FileLoggingSettings": {
"EnableFileLogging": true,
"LogFilePath": "Logs/audit.log"
},
"MessageBrokerSettings": {
"Enabled": true,
"Provider": "Kafka",
"ConnectionString": "kafka:9092"
},
"KafkaProducerConfig": {
"bootstrap.servers" : "kafka:9092",
"client.id" : "my-app-producer",
"acks" : "all",
"enable.idempotence" : true,
"message.send.max.retries" : 3,
"retry.backoff.ms" : 1000,
"linger.ms" : 5
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
3. Register Services (Program.cs)
using BaseQuc.Extensions;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// 1) EF Core DbContexts
builder.Services
.AddDbContext<MasterDbContext>(opts =>
opts.UseNpgsql(builder.Configuration.GetConnectionString("MasterConnection")))
.AddDbContext<SlaveDbContext>(opts =>
opts.UseNpgsql(builder.Configuration.GetConnectionString("SlaveConnection")));
// 2) BaseQuc Core (Repos & Services)
builder.Services.AddBaseQucCore<MasterDbContext>();
// 3) Caching
builder.Services.AddBaseQucCaching(builder.Configuration);
// 4) Message Broker (default no-op + Kafka override)
builder.Services
.AddBaseQucMessageBroker(builder.Configuration)
.AddBaseQucKafkaBroker();
// 5) Your domain registrations
builder.Services
.AddScoped<IProductsRepository, ProductsRepository>()
.AddScoped<ProductsCacheService>()
.AddScoped<IProductsService, ProductsService>();
builder.Services.AddControllers();
var app = builder.Build();
app.MapControllers();
app.Run();
4. Define Your Entity
using BaseQuc.Attributes;
using BaseQuc.Entity;
using BaseQuc.Enums;
namespace MyApp.Entities
{
[Auditable]
[Cacheable]
[Publish(PublishOn = Action.Create | Action.Update | Action.Delete)]
public class Products : BaseEntity
{
public string Name { get; set; } = "";
public string Code { get; set; } = "";
public ProductType Type { get; set; }
}
}
[Auditable]
→ writes audit trail[Cacheable]
→ enables read/update/delete caching[Publish]
→ sends events on Create/Update/Delete
5. Repository Implementation
using BaseQuc.Repositories.Interface;
using Microsoft.EntityFrameworkCore;
using MyApp.Entities;
namespace MyApp.Repositories
{
public class ProductsRepository
: IBaseRepository<Products, ProductsFilter, MasterDbContext, SlaveDbContext>
{
// Inject MasterDbContext & SlaveDbContext
// Implement GetByIdAsync, AddAsync, UpdateAsync, DeleteAsync,
// MarkAsDeletedAsync, UpdateStatusAsync, GetAllAsync, GetPagedAsync, etc.
}
}
6. Cache Service
using BaseQuc.Cache;
using BaseQuc.Cache.Interface;
using MyApp.Entities;
namespace MyApp.Cache
{
public class ProductsCacheService
: BaseEntityCacheService<Products>
{
protected override string CacheKeyPrefix => nameof(Products);
public ProductsCacheService(ICacheService cacheService)
: base(cacheService) { }
}
}
7. Domain Service
using BaseQuc.Cache.Interface;
using BaseQuc.MessageBroker.Interface;
using BaseQuc.Services;
using Microsoft.Extensions.Options;
using MyApp.Cache;
using MyApp.Entities;
using MyApp.Repositories;
using BaseQuc.Settings;
using BaseQuc.Utilities;
namespace MyApp.Services
{
public class ProductsService
: BaseService<
Products,
ProductsFilter,
MasterDbContext,
SlaveDbContext>,
IProductsService
{
public ProductsService(
IProductsRepository repo,
IStringLocalizer<LanguageResponse> loc,
IAuditTrailService auditSvc,
MasterDbContext mCtx,
SlaveDbContext sCtx,
IOptions<FileLoggingSettings> logOpts,
ICacheService cacheSvc,
IOptions<CacheSettings> cacheOpts,
ProductsCacheService cacheEntitySvc,
IBrokerService brokerSvc,
IOptions<MessageBrokerSettings> brokerOpts
) : base(
repo, loc, auditSvc, mCtx, sCtx,
logOpts, cacheSvc, cacheOpts,
cacheEntitySvc,
brokerSvc, brokerOpts
)
{ }
}
}
8. Web API Controller
using Microsoft.AspNetCore.Mvc;
using MyApp.Entities;
using MyApp.Services;
namespace MyApp.Controllers
{
[ApiController]
[Route("api/products")]
public class ProductsController : ControllerBase
{
private readonly IProductsService _svc;
public ProductsController(IProductsService svc) => _svc = svc;
[HttpGet("{id}")]
public async Task<IActionResult> Get(int id)
=> Ok(await _svc.GetByIdAsync(id));
[HttpPost]
public async Task<IActionResult> Create(Products p)
{
var created = await _svc.SaveAsync(p);
return CreatedAtAction(nameof(Get), new { id = created.Id }, created);
}
[HttpPut("{id}")]
public async Task<IActionResult> Update(int id, Products p)
{
await _svc.UpdateAsync(p, id);
return NoContent();
}
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(int id)
{
await _svc.DeleteAsync(id, user: "system", modifiedByIp: "127.0.0.1");
return NoContent();
}
}
}
9. Run & Verify
- Start your DB, Redis, and Kafka (e.g. via Docker Compose).
dotnet run
your API.- Test endpoints with Postman or cURL:
- GET → reads (caches on first hit)
- PUT → updates (refreshes cache & publishes event)
- DELETE → deletes (evicts cache & publishes event)
- Check Redis keys (
Products:{id}
) and Kafka topicProducts
for JSON messages.
Enjoy rapid CRUD + caching + messaging with minimal boilerplate!
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Confluent.Kafka (>= 1.9.2)
- Microsoft.EntityFrameworkCore (>= 8.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Serilog.AspNetCore (>= 6.0.1)
- StackExchange.Redis (>= 2.8.31)
- Swashbuckle.AspNetCore.Annotations (>= 6.2.3)
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.23 | 162 | 5/8/2025 |
1.0.22 | 152 | 4/27/2025 |
1.0.21 | 154 | 4/27/2025 |
1.0.20 | 149 | 4/27/2025 |
1.0.19 | 146 | 4/27/2025 |
1.0.18 | 155 | 4/27/2025 |
1.0.17 | 159 | 4/27/2025 |
1.0.16 | 93 | 4/26/2025 |
1.0.15 | 102 | 4/26/2025 |
1.0.14 | 105 | 4/26/2025 |
1.0.13 | 109 | 4/26/2025 |
1.0.12 | 94 | 4/26/2025 |
1.0.11 | 91 | 4/26/2025 |
1.0.10 | 91 | 4/26/2025 |
1.0.9 | 91 | 4/26/2025 |
1.0.8 | 86 | 4/26/2025 |
1.0.7 | 105 | 4/26/2025 |
1.0.6 | 83 | 4/26/2025 |
1.0.5 | 84 | 4/26/2025 |
1.0.4 | 101 | 4/25/2025 |
1.0.3 | 136 | 4/25/2025 |
1.0.2 | 127 | 4/25/2025 |
1.0.1 | 124 | 4/25/2025 |
1.0.0 | 135 | 4/25/2025 |