NetCoreBackend.NArchitecture.Core.Application
1.0.1
dotnet add package NetCoreBackend.NArchitecture.Core.Application --version 1.0.1
NuGet\Install-Package NetCoreBackend.NArchitecture.Core.Application -Version 1.0.1
<PackageReference Include="NetCoreBackend.NArchitecture.Core.Application" Version="1.0.1" />
<PackageVersion Include="NetCoreBackend.NArchitecture.Core.Application" Version="1.0.1" />
<PackageReference Include="NetCoreBackend.NArchitecture.Core.Application" />
paket add NetCoreBackend.NArchitecture.Core.Application --version 1.0.1
#r "nuget: NetCoreBackend.NArchitecture.Core.Application, 1.0.1"
#:package NetCoreBackend.NArchitecture.Core.Application@1.0.1
#addin nuget:?package=NetCoreBackend.NArchitecture.Core.Application&version=1.0.1
#tool nuget:?package=NetCoreBackend.NArchitecture.Core.Application&version=1.0.1
Core.Application
CQRS ve MediatR tabanlı uygulama katmanı altyapısı. Request pipeline behavior'ları, DTO base sınıfları ve iş kuralı doğrulama mekanizmaları içerir.
Pipeline Behaviors
Request'e ilgili interface eklenerek behavior aktif edilir:
| Behavior | Interface | Açıklama |
|---|---|---|
AuthorizationBehavior |
ISecuredRequest |
Rol tabanlı yetkilendirme. SuperAdmin tüm kontrolleri atlar (SuperAdmin gating için Roles = ["SuperAdmin"]). |
SuperAdminBlockBehavior |
IBlockedForSuperAdmin |
PlatformAdmin (impersonate etmeden) endpoint'i çağırırsa reddeder. Tenant-user-only operasyonlar için. |
RequestValidationBehavior |
otomatik | FluentValidation ile request doğrulama (ValidationException → 400) |
CachingBehavior |
ICachableRequest |
Distributed cache. Key'e tenant prefix otomatik eklenir. |
CacheRemovingBehavior |
ICacheRemoverRequest |
Cache grubu temizleme |
TransactionScopeBehavior |
ITransactionalRequest |
İşlem başarısız olursa rollback |
LoggingBehavior |
ILoggableRequest |
Request/response log. ISensitiveRequest implement edilirse payload "[redacted]" loglanır. |
PerformanceBehavior |
IIntervalRequest |
Yavaş request uyarısı |
TenantValidationBehavior |
ITenantValidationRequest |
Tenant context olmadan request reddedilir |
Cache key kuralı:
ICachableRequest.CacheKeyconsuming app'te benzersiz olmalı. Framework key'lerit:<tenantId>:<CacheKey>formatında prefix'liyor ama farklı handler'lar aynı CacheKey değerini kullanırsa cache çakışması ve deserialization hatası yaşanır. Konvansiyon:"Products:GetAll","Products:ById:{id}", asla yalın"Products".
ISensitiveRequest: Şifre, token, kredi kartı vb. veri taşıyan command'lara uygulayın —LoggingBehaviorpayload'ı redact eder, sadece request tipi loglanır.
Kullanım
// Secured + cached + tenant-validated bir query örneği
public class GetProductsQuery : IRequest<GetListResponse<ProductDto>>,
ISecuredRequest,
ICachableRequest,
ITenantValidationRequest
{
public string[] Roles => ["Manager", "Admin"];
// CacheKey query handler içinde benzersiz olmalı — bare "Products" değil,
// sorgu+parametre kimliğini yansıtan bir değer kullan (örn. "Products:GetAll").
public string CacheKey => "Products:GetAll";
public string? CacheGroupKey => "Products";
public bool BypassCache => false;
public TimeSpan? SlidingExpiration => null;
}
Bağımlılıklar
Core.Security— yetkilendirme ve claim extension'larıCore.MultiTenancy— ITenantContext ve tenant claim'leriCore.CrossCuttingConcerns.Exception— AuthorizationExceptionCore.CrossCuttingConcerns.Logging— LogDetail, LogParameter
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- FluentValidation (>= 12.1.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- MediatR (>= 14.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.5)
- Microsoft.EntityFrameworkCore.InMemory (>= 10.0.5)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.5)
- Microsoft.IdentityModel.Tokens (>= 8.15.0)
- NetCoreBackend.NArchitecture.Core.CrossCuttingConcerns.Exception (>= 1.0.0)
- NetCoreBackend.NArchitecture.Core.CrossCuttingConcerns.Logging (>= 1.0.0)
- NetCoreBackend.NArchitecture.Core.CrossCuttingConcerns.Logging.Abstraction (>= 1.0.0)
- NetCoreBackend.NArchitecture.Core.MultiTenancy (>= 1.0.1)
- NetCoreBackend.NArchitecture.Core.Security (>= 1.0.0)
- Otp.NET (>= 1.4.1)
- System.IdentityModel.Tokens.Jwt (>= 8.15.0)
- System.Linq.Dynamic.Core (>= 1.7.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.