ApexSoft.MediatR
1.0.6
dotnet add package ApexSoft.MediatR --version 1.0.6
NuGet\Install-Package ApexSoft.MediatR -Version 1.0.6
<PackageReference Include="ApexSoft.MediatR" Version="1.0.6" />
<PackageVersion Include="ApexSoft.MediatR" Version="1.0.6" />
<PackageReference Include="ApexSoft.MediatR" />
paket add ApexSoft.MediatR --version 1.0.6
#r "nuget: ApexSoft.MediatR, 1.0.6"
#:package ApexSoft.MediatR@1.0.6
#addin nuget:?package=ApexSoft.MediatR&version=1.0.6
#tool nuget:?package=ApexSoft.MediatR&version=1.0.6
ApexSoft.MediatR
ApexSoft.MediatR, .NET projelerinizde CQRS (Command Query Responsibility Segregation) desenini uygulamanızı sağlayan, hafif ve yüksek performanslı bir Mediator kütüphanesidir. Bu kütüphane, özellikle .NET Framework 4.8 gibi legacy sürümlerden .NET 9.0 gibi modern sürümlere kadar geniş bir yelpazede çalışan projeler için MediatR kütüphanesine alternatif olarak geliştirilmiştir.
🚀 Özellikler Hafif ve Hızlı: Gereksiz bağımlılıklardan arındırılmış saf CQRS yapısı.
Multi-Targeting: .NET Framework 4.8, 6.0, 7.0, 8.0 ve 9.0 sürümleriyle tam uyumludur.
Kolay Entegrasyon: IServiceCollection üzerinden tek satırla kayıt imkanı sunar.
Modern C# Desteği: Primary Constructors ve modern syntax özelliklerini destekler.
🛠 Kurulum Projenizde bağımlılıkların yönetildiği kısımda (örneğin ApplicationRegistration sınıfı) aşağıdaki tanımlamayı yaparak tüm Handler yapılarını otomatik olarak kaydedebilirsiniz:
C# public static class ApplicationRegistration { public static void AddApplicationServices(this IServiceCollection services) { // Belirtilen Assembly içindeki tüm IRequestHandler yapılarını tarar ve kaydeder. services.AddMediator(typeof(ApplicationRegistration).Assembly); } }
📖 Örnek Kullanım
- Query ve Handler Tanımlama İş mantığınızı Query ve Handler olarak tek bir dosyada organize ederek kod okunabilirliğini artırabilirsiniz:
C# public class GetAllDriverQuery : IRequest<ServiceResponse<IEnumerable<DriverDto>>> { public QueryOptions QueryOptions { get; set; }
public class GetAllDriverQueryHandler : IRequestHandler<GetAllDriverQuery, ServiceResponse<IEnumerable<DriverDto>>>
{
private readonly IDriverRepository _driverRepository;
private readonly IMapper _mapper;
public GetAllDriverQueryHandler(IDriverRepository driverRepository, IMapper mapper)
{
_driverRepository = driverRepository;
_mapper = mapper;
}
public async Task<ServiceResponse<IEnumerable<DriverDto>>> Handle(GetAllDriverQuery request, CancellationToken cancellationToken)
{
var driverEntities = await _driverRepository.GetAllAsync(request.QueryOptions);
var driverDtos = _mapper.Map<List<DriverDto>>(driverEntities);
return new ServiceResponse<IEnumerable<DriverDto>>(driverDtos, 200, "Success");
}
}
}
- Controller İçinde Kullanım Handler'ı tetiklemek için ISender arayüzünü enjekte etmeniz yeterlidir:
C# public class DriverController : ControllerBase { private readonly ISender _sender;
public DriverController(ISender sender)
{
_sender = sender;
}
[HttpGet("getall")]
public async Task<IActionResult> GetAllDriversAsync(QueryOptions options)
{
var query = new GetAllDriverQuery() { QueryOptions = options };
var result = await _sender.Send(query);
return Ok(result);
}
}
🏗 Mimari Yakıt Bu kütüphane; Onion Architecture veya Clean Architecture prensiplerine uygun olarak, komut ve sorgu işlemlerini birbirinden ayırarak yönetmenize olanak tanır.
Geliştirici: Seyfullah Tanrıverdi
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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. |
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Scrutor (>= 6.1.0)
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Scrutor (>= 6.1.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Scrutor (>= 6.1.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Scrutor (>= 6.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.