diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveAllocationsController.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveAllocationsController.cs index 8e57352f..a134ec20 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveAllocationsController.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveAllocationsController.cs @@ -5,6 +5,7 @@ using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using RCommon.Mediator; using System; using System.Collections.Generic; using System.Linq; @@ -19,9 +20,9 @@ namespace HR.LeaveManagement.Api.Controllers [Authorize] public class LeaveAllocationsController : ControllerBase { - private readonly IMediator _mediator; + private readonly IMediatorService _mediator; - public LeaveAllocationsController(IMediator mediator) + public LeaveAllocationsController(IMediatorService mediator) { _mediator = mediator; } @@ -30,7 +31,7 @@ public LeaveAllocationsController(IMediator mediator) [HttpGet] public async Task>> Get(bool isLoggedInUser = false) { - var leaveAllocations = await _mediator.Send(new GetLeaveAllocationListRequest() { IsLoggedInUser = isLoggedInUser }); + var leaveAllocations = await _mediator.Send>(new GetLeaveAllocationListRequest() { IsLoggedInUser = isLoggedInUser }); return Ok(leaveAllocations); } @@ -38,7 +39,7 @@ public async Task>> Get(bool isLoggedInUse [HttpGet("{id}")] public async Task> Get(int id) { - var leaveAllocation = await _mediator.Send(new GetLeaveAllocationDetailRequest { Id = id }); + var leaveAllocation = await _mediator.Send(new GetLeaveAllocationDetailRequest { Id = id }); return Ok(leaveAllocation); } @@ -47,7 +48,7 @@ public async Task> Get(int id) public async Task> Post([FromBody] CreateLeaveAllocationDto leaveAllocation) { var command = new CreateLeaveAllocationCommand { LeaveAllocationDto = leaveAllocation }; - var repsonse = await _mediator.Send(command); + var repsonse = await _mediator.Send(command); return Ok(repsonse); } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveRequestsController.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveRequestsController.cs index 9f94e32b..7856ae3e 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveRequestsController.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveRequestsController.cs @@ -5,6 +5,7 @@ using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using RCommon.Mediator; using System; using System.Collections.Generic; using System.Linq; @@ -19,9 +20,9 @@ namespace HR.LeaveManagement.Api.Controllers [Authorize] public class LeaveRequestsController : ControllerBase { - private readonly IMediator _mediator; + private readonly IMediatorService _mediator; - public LeaveRequestsController(IMediator mediator) + public LeaveRequestsController(IMediatorService mediator) { _mediator = mediator; } @@ -30,7 +31,7 @@ public LeaveRequestsController(IMediator mediator) [HttpGet] public async Task>> Get(bool isLoggedInUser = false) { - var leaveRequests = await _mediator.Send(new GetLeaveRequestListRequest() { IsLoggedInUser = isLoggedInUser }); + var leaveRequests = await _mediator.Send< GetLeaveRequestListRequest, List>(new GetLeaveRequestListRequest() { IsLoggedInUser = isLoggedInUser }); return Ok(leaveRequests); } @@ -38,7 +39,7 @@ public async Task>> Get(bool isLoggedInUs [HttpGet("{id}")] public async Task> Get(int id) { - var leaveRequest = await _mediator.Send(new GetLeaveRequestDetailRequest { Id = id }); + var leaveRequest = await _mediator.Send< GetLeaveRequestDetailRequest, LeaveRequestDto>(new GetLeaveRequestDetailRequest { Id = id }); return Ok(leaveRequest); } @@ -47,7 +48,7 @@ public async Task> Get(int id) public async Task> Post([FromBody] CreateLeaveRequestDto leaveRequest) { var command = new CreateLeaveRequestCommand { LeaveRequestDto = leaveRequest }; - var repsonse = await _mediator.Send(command); + var repsonse = await _mediator.Send< CreateLeaveRequestCommand, BaseCommandResponse>(command); return Ok(repsonse); } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveTypesController.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveTypesController.cs index 7444fa98..e232447f 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveTypesController.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Controllers/LeaveTypesController.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using RCommon.Mediator; using System; using System.Collections.Generic; using System.Linq; @@ -20,10 +21,10 @@ namespace HR.LeaveManagement.Api.Controllers [Authorize] public class LeaveTypesController : ControllerBase { - private readonly IMediator _mediator; + private readonly IMediatorService _mediator; private readonly IHttpContextAccessor _httpContextAccessor; - public LeaveTypesController(IMediator mediator, IHttpContextAccessor httpContextAccessor) + public LeaveTypesController(IMediatorService mediator, IHttpContextAccessor httpContextAccessor) { _mediator = mediator; this._httpContextAccessor = httpContextAccessor; @@ -33,7 +34,7 @@ public LeaveTypesController(IMediator mediator, IHttpContextAccessor httpContext [HttpGet] public async Task>> Get() { - var leaveTypes = await _mediator.Send(new GetLeaveTypeListRequest()); + var leaveTypes = await _mediator.Send< GetLeaveTypeListRequest, List>(new GetLeaveTypeListRequest()); return Ok(leaveTypes); } @@ -41,7 +42,7 @@ public async Task>> Get() [HttpGet("{id}")] public async Task> Get(int id) { - var leaveType = await _mediator.Send(new GetLeaveTypeDetailRequest { Id = id }); + var leaveType = await _mediator.Send(new GetLeaveTypeDetailRequest { Id = id }); return Ok(leaveType); } @@ -54,7 +55,7 @@ public async Task> Post([FromBody] CreateLeave { var user = _httpContextAccessor.HttpContext.User; var command = new CreateLeaveTypeCommand { LeaveTypeDto = leaveType }; - var response = await _mediator.Send(command); + var response = await _mediator.Send(command); return Ok(response); } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.API/HR.LeaveManagement.API.csproj b/Examples/CleanWithCQRS/HR.LeaveManagement.API/HR.LeaveManagement.API.csproj index 9e8d44c2..5171fc20 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.API/HR.LeaveManagement.API.csproj +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.API/HR.LeaveManagement.API.csproj @@ -8,7 +8,6 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Program.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Program.cs index 81a16a03..cdb56a83 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.API/Program.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.API/Program.cs @@ -13,6 +13,22 @@ using RCommon.Persistence.Transactions; using RCommon.Mediator.MediatR; using System.Reflection; +using HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Commands; +using HR.LeaveManagement.Application.Features.LeaveAllocations.Handlers.Commands; +using HR.LeaveManagement.Application.Responses; +using HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Queries; +using HR.LeaveManagement.Application.Features.LeaveAllocations.Handlers.Queries; +using HR.LeaveManagement.Application.DTOs.LeaveAllocation; +using HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Commands; +using HR.LeaveManagement.Application.Features.LeaveRequests.Handlers.Commands; +using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; +using HR.LeaveManagement.Application.Features.LeaveTypes.Handlers.Commands; +using HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Queries; +using HR.LeaveManagement.Application.Features.LeaveRequests.Handlers.Queries; +using HR.LeaveManagement.Application.DTOs.LeaveRequest; +using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Queries; +using HR.LeaveManagement.Application.Features.LeaveTypes.Handlers.Queries; +using HR.LeaveManagement.Application.DTOs.LeaveType; var builder = WebApplication.CreateBuilder(args); @@ -34,6 +50,26 @@ .WithSequentialGuidGenerator(guid => guid.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString) .WithMediator(mediator => { + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest, GetLeaveAllocationListRequestHandler>(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest, GetLeaveRequestListRequestHandler>(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest(); + mediator.AddRequest, GetLeaveTypeListRequestHandler>(); + mediator.Configure(config => { config.RegisterServicesFromAssemblies((typeof(ApplicationServicesRegistration).GetTypeInfo().Assembly)); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Commands/CreateLeaveTypeCommandHandlerTests.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Commands/CreateLeaveTypeCommandHandlerTests.cs index 852c84a3..a37e551b 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Commands/CreateLeaveTypeCommandHandlerTests.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Commands/CreateLeaveTypeCommandHandlerTests.cs @@ -56,7 +56,7 @@ public CreateLeaveTypeCommandHandlerTests() [Test] public async Task Valid_LeaveType_Added() { - var result = await _handler.Handle(new CreateLeaveTypeCommand() { LeaveTypeDto = _leaveTypeDto }, CancellationToken.None); + var result = await _handler.HandleAsync(new CreateLeaveTypeCommand() { LeaveTypeDto = _leaveTypeDto }, CancellationToken.None); result.ShouldBeOfType(); } @@ -66,7 +66,7 @@ public async Task InValid_LeaveType_Added() { _leaveTypeDto.DefaultDays = -1; - var result = await _handler.Handle(new CreateLeaveTypeCommand() { LeaveTypeDto = _leaveTypeDto }, CancellationToken.None); + var result = await _handler.HandleAsync(new CreateLeaveTypeCommand() { LeaveTypeDto = _leaveTypeDto }, CancellationToken.None); //leaveTypes.Count.ShouldBe(3); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Queries/GetLeaveTypeListRequestHandlerTests.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Queries/GetLeaveTypeListRequestHandlerTests.cs index 36e65b0e..7ee68fe6 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Queries/GetLeaveTypeListRequestHandlerTests.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/LeaveTypes/Queries/GetLeaveTypeListRequestHandlerTests.cs @@ -48,7 +48,7 @@ public async Task GetLeaveTypeListTest() .Returns(() => Task.FromResult(testData as ICollection)); var handler = new GetLeaveTypeListRequestHandler(mock.Object, _mapper); - var result = await handler.Handle(new GetLeaveTypeListRequest(), CancellationToken.None); + var result = await handler.HandleAsync(new GetLeaveTypeListRequest(), CancellationToken.None); result.ShouldBeOfType>(); result.Count.ShouldBe(5); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/MediatorHandlerRegistrationTests.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/MediatorHandlerRegistrationTests.cs index 095fe3d6..c15707d6 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/MediatorHandlerRegistrationTests.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/MediatorHandlerRegistrationTests.cs @@ -1,6 +1,6 @@ using FluentAssertions; -using MediatR; using NUnit.Framework; +using RCommon.Mediator.Subscribers; using RCommon.TestBase; using Shouldly; using System; @@ -35,12 +35,12 @@ private static void ShouldContainHandlerForRequest(IEnumerable handlerType private static bool IsRequest(Type type) { - return typeof(IBaseRequest).IsAssignableFrom(type); + return typeof(IAppRequest).IsAssignableFrom(type); } private static bool IsIRequestHandler(Type type) { - return type.GetInterfaces().Any(interfaceType => interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IRequestHandler<,>)); + return type.GetInterfaces().Any(interfaceType => interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IAppRequestHandler<,>)); } private static bool IsHandlerForRequest(Type handlerType, Type requestType) diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/CreateLeaveAllocationCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/CreateLeaveAllocationCommandHandler.cs index 9f01329b..4d2fc4eb 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/CreateLeaveAllocationCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/CreateLeaveAllocationCommandHandler.cs @@ -4,7 +4,7 @@ using HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Commands; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -19,7 +19,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Handlers.Commands { - public class CreateLeaveAllocationCommandHandler : IRequestHandler + public class CreateLeaveAllocationCommandHandler : IAppRequestHandler { private readonly IGraphRepository _leaveTypeRepository; private readonly IGraphRepository _leaveAllocationRepository; @@ -39,7 +39,7 @@ public CreateLeaveAllocationCommandHandler(IGraphRepository leaveType _mapper = mapper; } - public async Task Handle(CreateLeaveAllocationCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(CreateLeaveAllocationCommand request, CancellationToken cancellationToken) { var response = new BaseCommandResponse(); var validator = new CreateLeaveAllocationDtoValidator(_leaveTypeRepository); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/DeleteLeaveAllocationCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/DeleteLeaveAllocationCommandHandler.cs index 402381fb..704c1158 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/DeleteLeaveAllocationCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/DeleteLeaveAllocationCommandHandler.cs @@ -3,7 +3,7 @@ using HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Commands; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -14,7 +14,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Handlers.Commands { - public class DeleteLeaveAllocationCommandHandler : IRequestHandler + public class DeleteLeaveAllocationCommandHandler : IAppRequestHandler { private readonly IGraphRepository _leaveAllocationRepository; private readonly IMapper _mapper; @@ -26,7 +26,7 @@ public DeleteLeaveAllocationCommandHandler(IGraphRepository lea _mapper = mapper; } - public async Task Handle(DeleteLeaveAllocationCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(DeleteLeaveAllocationCommand request, CancellationToken cancellationToken) { var leaveAllocation = await _leaveAllocationRepository.FindAsync(request.Id); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/UpdateLeaveAllocationCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/UpdateLeaveAllocationCommandHandler.cs index 1e7a8e77..23a28fe6 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/UpdateLeaveAllocationCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Commands/UpdateLeaveAllocationCommandHandler.cs @@ -4,7 +4,7 @@ using HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Commands; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -15,7 +15,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Handlers.Commands { - public class UpdateLeaveAllocationCommandHandler : IRequestHandler + public class UpdateLeaveAllocationCommandHandler : IAppRequestHandler { private readonly IGraphRepository _leaveAllocationRepository; private readonly IReadOnlyRepository _leaveTypeRepository; @@ -32,7 +32,7 @@ public UpdateLeaveAllocationCommandHandler(IGraphRepository lea _mapper = mapper; } - public async Task Handle(UpdateLeaveAllocationCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(UpdateLeaveAllocationCommand request, CancellationToken cancellationToken) { var validator = new UpdateLeaveAllocationDtoValidator(this._leaveTypeRepository); var validationResult = await validator.ValidateAsync(request.LeaveAllocationDto); @@ -48,7 +48,7 @@ public async Task Handle(UpdateLeaveAllocationCommand request, Cancellatio _mapper.Map(request.LeaveAllocationDto, leaveAllocation); await _leaveAllocationRepository.UpdateAsync(leaveAllocation); - return Unit.Value; + } } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationDetailRequestHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationDetailRequestHandler.cs index 637faea4..eb09fbe4 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationDetailRequestHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationDetailRequestHandler.cs @@ -3,7 +3,7 @@ using HR.LeaveManagement.Application.DTOs.LeaveAllocation; using HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Queries; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using RCommon.Persistence; using RCommon.Persistence.Crud; using System.Threading; @@ -11,7 +11,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Handlers.Queries { - public class GetLeaveAllocationDetailRequestHandler : IRequestHandler + public class GetLeaveAllocationDetailRequestHandler : IAppRequestHandler { private readonly IGraphRepository _leaveAllocationRepository; private readonly IMapper _mapper; @@ -22,7 +22,7 @@ public GetLeaveAllocationDetailRequestHandler(IGraphRepository this._leaveAllocationRepository.DataStoreName = DataStoreNamesConst.LeaveManagement; _mapper = mapper; } - public async Task Handle(GetLeaveAllocationDetailRequest request, CancellationToken cancellationToken) + public async Task HandleAsync(GetLeaveAllocationDetailRequest request, CancellationToken cancellationToken) { _leaveAllocationRepository.Include(x => x.LeaveType); var leaveAllocation = await _leaveAllocationRepository.FindAsync(request.Id); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationListRequestHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationListRequestHandler.cs index afcb8849..73614759 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationListRequestHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Handlers/Queries/GetLeaveAllocationListRequestHandler.cs @@ -2,7 +2,7 @@ using HR.LeaveManagement.Application.DTOs; using HR.LeaveManagement.Application.DTOs.LeaveAllocation; using HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Queries; -using MediatR; +using RCommon.Mediator.Subscribers; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -16,7 +16,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Handlers.Queries { - public class GetLeaveAllocationListRequestHandler : IRequestHandler> + public class GetLeaveAllocationListRequestHandler : IAppRequestHandler> { private readonly IGraphRepository _leaveAllocationRepository; private readonly IMapper _mapper; @@ -35,7 +35,7 @@ public GetLeaveAllocationListRequestHandler(IGraphRepository le this._userService = userService; } - public async Task> Handle(GetLeaveAllocationListRequest request, CancellationToken cancellationToken) + public async Task> HandleAsync(GetLeaveAllocationListRequest request, CancellationToken cancellationToken) { var leaveAllocations = new List(); var allocations = new List(); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/CreateLeaveAllocationCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/CreateLeaveAllocationCommand.cs index b10552d3..67b4d466 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/CreateLeaveAllocationCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/CreateLeaveAllocationCommand.cs @@ -1,14 +1,14 @@ using HR.LeaveManagement.Application.DTOs.LeaveAllocation; using HR.LeaveManagement.Application.DTOs.LeaveType; using HR.LeaveManagement.Application.Responses; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Commands { - public class CreateLeaveAllocationCommand : IRequest + public class CreateLeaveAllocationCommand : IAppRequest { public CreateLeaveAllocationDto LeaveAllocationDto { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/DeleteLeaveAllocationCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/DeleteLeaveAllocationCommand.cs index 71f26b7c..fd1bbf2f 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/DeleteLeaveAllocationCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/DeleteLeaveAllocationCommand.cs @@ -1,11 +1,11 @@ -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Commands { - public class DeleteLeaveAllocationCommand : IRequest + public class DeleteLeaveAllocationCommand : IAppRequest { public int Id { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/UpdateLeaveAllocationCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/UpdateLeaveAllocationCommand.cs index e67e263d..60c9bf90 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/UpdateLeaveAllocationCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Commands/UpdateLeaveAllocationCommand.cs @@ -1,13 +1,13 @@ using HR.LeaveManagement.Application.DTOs.LeaveAllocation; using HR.LeaveManagement.Application.DTOs.LeaveType; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Commands { - public class UpdateLeaveAllocationCommand : IRequest + public class UpdateLeaveAllocationCommand : IAppRequest { public UpdateLeaveAllocationDto LeaveAllocationDto { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationDetailRequest.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationDetailRequest.cs index cfc76a8b..aa7203a8 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationDetailRequest.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationDetailRequest.cs @@ -1,14 +1,14 @@ using HR.LeaveManagement.Application.DTOs; using HR.LeaveManagement.Application.DTOs.LeaveAllocation; using HR.LeaveManagement.Application.DTOs.LeaveRequest; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Queries { - public class GetLeaveAllocationDetailRequest : IRequest + public class GetLeaveAllocationDetailRequest : IAppRequest { public int Id { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationListRequest.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationListRequest.cs index 176d5247..3712d2da 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationListRequest.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveAllocations/Requests/Queries/GetLeaveAllocationListRequest.cs @@ -1,14 +1,14 @@ using HR.LeaveManagement.Application.DTOs; using HR.LeaveManagement.Application.DTOs.LeaveAllocation; using HR.LeaveManagement.Application.DTOs.LeaveRequest; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveAllocations.Requests.Queries { - public class GetLeaveAllocationListRequest : IRequest> + public class GetLeaveAllocationListRequest : IAppRequest> { public bool IsLoggedInUser { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/CreateLeaveRequestCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/CreateLeaveRequestCommandHandler.cs index 2e4cbd96..30aa9696 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/CreateLeaveRequestCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/CreateLeaveRequestCommandHandler.cs @@ -5,7 +5,7 @@ using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Application.Responses; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Linq; @@ -26,7 +26,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveRequests.Handlers.Commands { - public class CreateLeaveRequestCommandHandler : IRequestHandler + public class CreateLeaveRequestCommandHandler : IAppRequestHandler { private readonly IEmailService _emailSender; private readonly ICurrentUser _currentUser; @@ -57,7 +57,7 @@ public CreateLeaveRequestCommandHandler( _mapper = mapper; } - public async Task Handle(CreateLeaveRequestCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(CreateLeaveRequestCommand request, CancellationToken cancellationToken) { var response = new BaseCommandResponse(); var validator = new CreateLeaveRequestDtoValidator(_leaveTypeRepository); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/DeleteLeaveRequestCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/DeleteLeaveRequestCommandHandler.cs index d50d5fcc..33f6d3a4 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/DeleteLeaveRequestCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/DeleteLeaveRequestCommandHandler.cs @@ -3,7 +3,7 @@ using HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Commands; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -14,7 +14,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveRequests.Handlers.Commands { - public class DeleteLeaveRequestCommandHandler : IRequestHandler + public class DeleteLeaveRequestCommandHandler : IAppRequestHandler { private readonly IGraphRepository _leaveRequestRepository; @@ -24,7 +24,7 @@ public DeleteLeaveRequestCommandHandler(IGraphRepository leaveRequ this._leaveRequestRepository.DataStoreName = DataStoreNamesConst.LeaveManagement; } - public async Task Handle(DeleteLeaveRequestCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(DeleteLeaveRequestCommand request, CancellationToken cancellationToken) { var leaveRequest = await _leaveRequestRepository.FindAsync(request.Id); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/UpdateLeaveRequestCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/UpdateLeaveRequestCommandHandler.cs index 910b81c9..628945b1 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/UpdateLeaveRequestCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Commands/UpdateLeaveRequestCommandHandler.cs @@ -5,7 +5,7 @@ using HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Commands; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -16,7 +16,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveRequests.Handlers.Commands { - public class UpdateLeaveRequestCommandHandler : IRequestHandler + public class UpdateLeaveRequestCommandHandler : IAppRequestHandler { private readonly IGraphRepository _leaveRequestRepository; private readonly IReadOnlyRepository _leaveTypeRepository; @@ -38,7 +38,7 @@ public UpdateLeaveRequestCommandHandler( _mapper = mapper; } - public async Task Handle(UpdateLeaveRequestCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(UpdateLeaveRequestCommand request, CancellationToken cancellationToken) { var leaveRequest = await _leaveRequestRepository.FindAsync(request.Id); @@ -73,7 +73,7 @@ public async Task Handle(UpdateLeaveRequestCommand request, CancellationTo } } - return Unit.Value; + } } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestDetailRequestHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestDetailRequestHandler.cs index 8986137d..7136a0e2 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestDetailRequestHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestDetailRequestHandler.cs @@ -4,7 +4,7 @@ using HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Queries; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Queries; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -17,7 +17,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveRequests.Handlers.Queries { - public class GetLeaveRequestDetailRequestHandler : IRequestHandler + public class GetLeaveRequestDetailRequestHandler : IAppRequestHandler { private readonly IGraphRepository _leaveRequestRepository; private readonly IMapper _mapper; @@ -32,7 +32,7 @@ public GetLeaveRequestDetailRequestHandler(IGraphRepository leaveR _mapper = mapper; this._userService = userService; } - public async Task Handle(GetLeaveRequestDetailRequest request, CancellationToken cancellationToken) + public async Task HandleAsync(GetLeaveRequestDetailRequest request, CancellationToken cancellationToken) { _leaveRequestRepository.Include(x => x.LeaveType); var leaveRequest = _mapper.Map(await _leaveRequestRepository.FindAsync(request.Id)); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestListRequestHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestListRequestHandler.cs index 27e2ef64..31c60552 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestListRequestHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Handlers/Queries/GetLeaveRequestListRequestHandler.cs @@ -4,7 +4,7 @@ using HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Queries; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Queries; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -19,7 +19,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveRequests.Handlers.Queries { - public class GetLeaveRequestListRequestHandler : IRequestHandler> + public class GetLeaveRequestListRequestHandler : IAppRequestHandler> { private readonly IGraphRepository _leaveRequestRepository; private readonly IMapper _mapper; @@ -38,7 +38,7 @@ public GetLeaveRequestListRequestHandler(IGraphRepository leaveReq this._userService = userService; } - public async Task> Handle(GetLeaveRequestListRequest request, CancellationToken cancellationToken) + public async Task> HandleAsync(GetLeaveRequestListRequest request, CancellationToken cancellationToken) { var leaveRequests = new List(); var requests = new List(); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/CreateLeaveRequestCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/CreateLeaveRequestCommand.cs index ed9773de..781c2d25 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/CreateLeaveRequestCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/CreateLeaveRequestCommand.cs @@ -1,14 +1,14 @@ using HR.LeaveManagement.Application.DTOs.LeaveRequest; using HR.LeaveManagement.Application.DTOs.LeaveType; using HR.LeaveManagement.Application.Responses; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Commands { - public class CreateLeaveRequestCommand : IRequest + public class CreateLeaveRequestCommand : IAppRequest { public CreateLeaveRequestDto LeaveRequestDto { get; set; } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/DeleteLeaveRequestCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/DeleteLeaveRequestCommand.cs index c9333df2..1a07ee61 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/DeleteLeaveRequestCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/DeleteLeaveRequestCommand.cs @@ -1,11 +1,11 @@ -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Commands { - public class DeleteLeaveRequestCommand : IRequest + public class DeleteLeaveRequestCommand : IAppRequest { public int Id { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/UpdateLeaveRequestCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/UpdateLeaveRequestCommand.cs index dfe16450..dab3db30 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/UpdateLeaveRequestCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Commands/UpdateLeaveRequestCommand.cs @@ -1,13 +1,13 @@ using HR.LeaveManagement.Application.DTOs.LeaveRequest; using HR.LeaveManagement.Application.DTOs.LeaveType; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Commands { - public class UpdateLeaveRequestCommand : IRequest + public class UpdateLeaveRequestCommand : IAppRequest { public int Id { get; set; } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestDetailRequest.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestDetailRequest.cs index 376ac7fd..f7252524 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestDetailRequest.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestDetailRequest.cs @@ -1,13 +1,13 @@ using HR.LeaveManagement.Application.DTOs; using HR.LeaveManagement.Application.DTOs.LeaveRequest; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Queries { - public class GetLeaveRequestDetailRequest : IRequest + public class GetLeaveRequestDetailRequest : IAppRequest { public int Id { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestListRequest.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestListRequest.cs index a28d070a..9b4c9064 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestListRequest.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveRequests/Requests/Queries/GetLeaveRequestListRequest.cs @@ -1,13 +1,13 @@ using HR.LeaveManagement.Application.DTOs; using HR.LeaveManagement.Application.DTOs.LeaveRequest; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveRequests.Requests.Queries { - public class GetLeaveRequestListRequest : IRequest> + public class GetLeaveRequestListRequest : IAppRequest> { public bool IsLoggedInUser { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/CreateLeaveTypeCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/CreateLeaveTypeCommandHandler.cs index 7aced91a..523b5482 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/CreateLeaveTypeCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/CreateLeaveTypeCommandHandler.cs @@ -3,7 +3,7 @@ using HR.LeaveManagement.Application.Exceptions; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -16,7 +16,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveTypes.Handlers.Commands { - public class CreateLeaveTypeCommandHandler : IRequestHandler + public class CreateLeaveTypeCommandHandler : IAppRequestHandler { private readonly IMapper _mapper; private readonly IGraphRepository _leaveTypeRepository; @@ -27,7 +27,7 @@ public CreateLeaveTypeCommandHandler(IMapper mapper, IGraphRepository this._leaveTypeRepository.DataStoreName = DataStoreNamesConst.LeaveManagement; } - public async Task Handle(CreateLeaveTypeCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(CreateLeaveTypeCommand request, CancellationToken cancellationToken) { var response = new BaseCommandResponse(); var validator = new CreateLeaveTypeDtoValidator(); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/DeleteLeaveTypeCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/DeleteLeaveTypeCommandHandler.cs index 410c0243..d3de1054 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/DeleteLeaveTypeCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/DeleteLeaveTypeCommandHandler.cs @@ -2,7 +2,7 @@ using HR.LeaveManagement.Application.Exceptions; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using RCommon.Persistence; using RCommon.Persistence.Crud; using System; @@ -13,7 +13,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveTypes.Handlers.Commands { - public class DeleteLeaveTypeCommandHandler : IRequestHandler + public class DeleteLeaveTypeCommandHandler : IAppRequestHandler { private readonly IMapper _mapper; private readonly IGraphRepository _leaveTypeRepository; @@ -25,7 +25,7 @@ public DeleteLeaveTypeCommandHandler(IMapper mapper, IGraphRepository this._leaveTypeRepository.DataStoreName = DataStoreNamesConst.LeaveManagement; } - public async Task Handle(DeleteLeaveTypeCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(DeleteLeaveTypeCommand request, CancellationToken cancellationToken) { var leaveType = await _leaveTypeRepository.FindAsync(request.Id); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/UpdateLeaveTypeCommandHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/UpdateLeaveTypeCommandHandler.cs index ba35cfc5..c5ab679a 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/UpdateLeaveTypeCommandHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Commands/UpdateLeaveTypeCommandHandler.cs @@ -3,7 +3,7 @@ using HR.LeaveManagement.Application.Exceptions; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; @@ -14,7 +14,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveTypes.Handlers.Commands { - public class UpdateLeaveTypeCommandHandler : IRequestHandler + public class UpdateLeaveTypeCommandHandler : IAppRequestHandler { private readonly IMapper _mapper; private readonly IGraphRepository _leaveTypeRepository; @@ -26,7 +26,7 @@ public UpdateLeaveTypeCommandHandler(IMapper mapper, IGraphRepository this._leaveTypeRepository.DataStoreName = DataStoreNamesConst.LeaveManagement; } - public async Task Handle(UpdateLeaveTypeCommand request, CancellationToken cancellationToken) + public async Task HandleAsync(UpdateLeaveTypeCommand request, CancellationToken cancellationToken) { var validator = new UpdateLeaveTypeDtoValidator(); var validationResult = await validator.ValidateAsync(request.LeaveTypeDto); @@ -43,7 +43,7 @@ public async Task Handle(UpdateLeaveTypeCommand request, CancellationToken await _leaveTypeRepository.UpdateAsync(leaveType); - return Unit.Value; + } } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeDetailRequestHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeDetailRequestHandler.cs index 02a97bdb..76f3b9c4 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeDetailRequestHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeDetailRequestHandler.cs @@ -5,7 +5,7 @@ using HR.LeaveManagement.Application.Features.LeaveTypes.Requests; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Queries; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using RCommon.Persistence; using RCommon.Persistence.Crud; using System; @@ -16,7 +16,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveTypes.Handlers.Queries { - public class GetLeaveTypeDetailRequestHandler : IRequestHandler + public class GetLeaveTypeDetailRequestHandler : IAppRequestHandler { private readonly IGraphRepository _leaveTypeRepository; private readonly IMapper _mapper; @@ -27,7 +27,7 @@ public GetLeaveTypeDetailRequestHandler(IGraphRepository leaveTypeRep this._leaveTypeRepository.DataStoreName = DataStoreNamesConst.LeaveManagement; _mapper = mapper; } - public async Task Handle(GetLeaveTypeDetailRequest request, CancellationToken cancellationToken) + public async Task HandleAsync(GetLeaveTypeDetailRequest request, CancellationToken cancellationToken) { var leaveType = await _leaveTypeRepository.FindAsync(request.Id); return _mapper.Map(leaveType); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeListRequestHandler.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeListRequestHandler.cs index cc24af36..b4f7a4f1 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeListRequestHandler.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Handlers/Queries/GetLeaveTypeListRequestHandler.cs @@ -4,7 +4,7 @@ using HR.LeaveManagement.Application.Features.LeaveTypes.Requests; using HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Queries; using HR.LeaveManagement.Domain; -using MediatR; +using RCommon.Mediator.Subscribers; using RCommon.Persistence; using RCommon.Persistence.Crud; using System; @@ -15,7 +15,7 @@ namespace HR.LeaveManagement.Application.Features.LeaveTypes.Handlers.Queries { - public class GetLeaveTypeListRequestHandler : IRequestHandler> + public class GetLeaveTypeListRequestHandler : IAppRequestHandler> { private readonly IGraphRepository _leaveTypeRepository; private readonly IMapper _mapper; @@ -27,7 +27,7 @@ public GetLeaveTypeListRequestHandler(IGraphRepository leaveTypeRepos _mapper = mapper; } - public async Task> Handle(GetLeaveTypeListRequest request, CancellationToken cancellationToken) + public async Task> HandleAsync(GetLeaveTypeListRequest request, CancellationToken cancellationToken) { var leaveTypes = await _leaveTypeRepository.FindAsync(x=> true); return _mapper.Map>(leaveTypes); diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/CreateLeaveTypeCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/CreateLeaveTypeCommand.cs index 194203fb..02474d54 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/CreateLeaveTypeCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/CreateLeaveTypeCommand.cs @@ -1,13 +1,13 @@ using HR.LeaveManagement.Application.DTOs.LeaveType; using HR.LeaveManagement.Application.Responses; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands { - public class CreateLeaveTypeCommand : IRequest + public class CreateLeaveTypeCommand : IAppRequest { public CreateLeaveTypeDto LeaveTypeDto { get; set; } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/DeleteLeaveRequestCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/DeleteLeaveRequestCommand.cs index 5ff89cae..e526514f 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/DeleteLeaveRequestCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/DeleteLeaveRequestCommand.cs @@ -1,11 +1,11 @@ -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands { - public class DeleteLeaveTypeCommand : IRequest + public class DeleteLeaveTypeCommand : IAppRequest { public int Id { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/UpdateLeaveTypeCommand.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/UpdateLeaveTypeCommand.cs index 4dd1bd27..bdce450c 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/UpdateLeaveTypeCommand.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Commands/UpdateLeaveTypeCommand.cs @@ -1,12 +1,12 @@ using HR.LeaveManagement.Application.DTOs.LeaveType; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Commands { - public class UpdateLeaveTypeCommand : IRequest + public class UpdateLeaveTypeCommand : IAppRequest { public LeaveTypeDto LeaveTypeDto { get; set; } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeDetailRequest.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeDetailRequest.cs index 7ed6d823..5f4b1e1c 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeDetailRequest.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeDetailRequest.cs @@ -1,13 +1,13 @@ using HR.LeaveManagement.Application.DTOs; using HR.LeaveManagement.Application.DTOs.LeaveType; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Queries { - public class GetLeaveTypeDetailRequest : IRequest + public class GetLeaveTypeDetailRequest : IAppRequest { public int Id { get; set; } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeListRequest.cs b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeListRequest.cs index d050855b..b2259c9c 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeListRequest.cs +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/Features/LeaveTypes/Requests/Queries/GetLeaveTypeListRequest.cs @@ -1,13 +1,13 @@ using HR.LeaveManagement.Application.DTOs; using HR.LeaveManagement.Application.DTOs.LeaveType; -using MediatR; +using RCommon.Mediator.Subscribers; using System; using System.Collections.Generic; using System.Text; namespace HR.LeaveManagement.Application.Features.LeaveTypes.Requests.Queries { - public class GetLeaveTypeListRequest : IRequest> + public class GetLeaveTypeListRequest : IAppRequest> { } } diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/HR.LeaveManagement.Application.csproj b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/HR.LeaveManagement.Application.csproj index 6826a06b..40b332ce 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application/HR.LeaveManagement.Application.csproj +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application/HR.LeaveManagement.Application.csproj @@ -8,12 +8,12 @@ - + diff --git a/Src/RCommon.ApplicationServices/RCommon.ApplicationServices.csproj b/Src/RCommon.ApplicationServices/RCommon.ApplicationServices.csproj index ddd7a85b..017b1211 100644 --- a/Src/RCommon.ApplicationServices/RCommon.ApplicationServices.csproj +++ b/Src/RCommon.ApplicationServices/RCommon.ApplicationServices.csproj @@ -10,7 +10,7 @@ A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. Jason Webb RCommon - 2.0.0.7 + 2.0.0.8 GitHub RCommon, application services, CQRS, auto web api, commands, command handlers, queries, query handlers, command bus, query bus, c#, .NET Apache-2.0 diff --git a/Src/RCommon.Authorization.Web/RCommon.Authorization.Web.csproj b/Src/RCommon.Authorization.Web/RCommon.Authorization.Web.csproj index 0bf4efc3..ad688630 100644 --- a/Src/RCommon.Authorization.Web/RCommon.Authorization.Web.csproj +++ b/Src/RCommon.Authorization.Web/RCommon.Authorization.Web.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Core/Configuration/RCommonBuilder.cs b/Src/RCommon.Core/Configuration/RCommonBuilder.cs index 090c0585..cd45e536 100644 --- a/Src/RCommon.Core/Configuration/RCommonBuilder.cs +++ b/Src/RCommon.Core/Configuration/RCommonBuilder.cs @@ -22,8 +22,7 @@ public RCommonBuilder(IServiceCollection services) Services = services; // Event Bus - //Services.AddSingleton(); // Set up default event bus - services.AddSingleton(sp => + services.AddScoped(sp => { return new InMemoryEventBus(sp, services); }); @@ -44,7 +43,7 @@ public IRCommonBuilder WithSimpleGuidGenerator() { Guard.Against(this._guidConfigured, "Guid Generator has already been configured once. You cannot configure multiple times"); - this.Services.AddTransient(); + this.Services.AddScoped(); this._guidConfigured = true; return this; } diff --git a/Src/RCommon.Core/RCommon.Core.csproj b/Src/RCommon.Core/RCommon.Core.csproj index 0612750b..2fbe4965 100644 --- a/Src/RCommon.Core/RCommon.Core.csproj +++ b/Src/RCommon.Core/RCommon.Core.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Dapper/RCommon.Dapper.csproj b/Src/RCommon.Dapper/RCommon.Dapper.csproj index f0716050..f3df0455 100644 --- a/Src/RCommon.Dapper/RCommon.Dapper.csproj +++ b/Src/RCommon.Dapper/RCommon.Dapper.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.EfCore/RCommon.EFCore.csproj b/Src/RCommon.EfCore/RCommon.EFCore.csproj index b67d099c..022aa86b 100644 --- a/Src/RCommon.EfCore/RCommon.EFCore.csproj +++ b/Src/RCommon.EfCore/RCommon.EFCore.csproj @@ -3,7 +3,7 @@ enable net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Emailing/RCommon.Emailing.csproj b/Src/RCommon.Emailing/RCommon.Emailing.csproj index 1398e74a..59f50743 100644 --- a/Src/RCommon.Emailing/RCommon.Emailing.csproj +++ b/Src/RCommon.Emailing/RCommon.Emailing.csproj @@ -13,7 +13,7 @@ RCommon, emailing, email abstractions, smtp true GitHub - 2.0.0.7 + 2.0.0.8 Apache-2.0 diff --git a/Src/RCommon.Entities/RCommon.Entities.csproj b/Src/RCommon.Entities/RCommon.Entities.csproj index fcc8aebc..fb2833a2 100644 --- a/Src/RCommon.Entities/RCommon.Entities.csproj +++ b/Src/RCommon.Entities/RCommon.Entities.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Linq2Db/RCommon.Linq2Db.csproj b/Src/RCommon.Linq2Db/RCommon.Linq2Db.csproj index 791f2836..35445652 100644 --- a/Src/RCommon.Linq2Db/RCommon.Linq2Db.csproj +++ b/Src/RCommon.Linq2Db/RCommon.Linq2Db.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.MassTransit/RCommon.MassTransit.csproj b/Src/RCommon.MassTransit/RCommon.MassTransit.csproj index 671d88a1..dd4a9b2f 100644 --- a/Src/RCommon.MassTransit/RCommon.MassTransit.csproj +++ b/Src/RCommon.MassTransit/RCommon.MassTransit.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Mediator/MediatorBuilderExtensions.cs b/Src/RCommon.Mediator/MediatorBuilderExtensions.cs index 50e6d6aa..1f0979f8 100644 --- a/Src/RCommon.Mediator/MediatorBuilderExtensions.cs +++ b/Src/RCommon.Mediator/MediatorBuilderExtensions.cs @@ -23,7 +23,7 @@ public static IRCommonBuilder WithMediator(this IRCommonBuilder builder, Acti where T : IMediatorBuilder { - builder.Services.AddSingleton(); + builder.Services.AddScoped(); // Event Handling Configurations var mediatorConfig = (T)Activator.CreateInstance(typeof(T), new object[] { builder }); diff --git a/Src/RCommon.Mediator/RCommon.Mediator.csproj b/Src/RCommon.Mediator/RCommon.Mediator.csproj index 1466d9cd..a94dd7e3 100644 --- a/Src/RCommon.Mediator/RCommon.Mediator.csproj +++ b/Src/RCommon.Mediator/RCommon.Mediator.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Mediatr/MediatRBuilder.cs b/Src/RCommon.Mediatr/MediatRBuilder.cs index d7a65b6a..183b82b4 100644 --- a/Src/RCommon.Mediatr/MediatRBuilder.cs +++ b/Src/RCommon.Mediatr/MediatRBuilder.cs @@ -27,7 +27,7 @@ public MediatRBuilder(IRCommonBuilder builder) protected void RegisterServices(IServiceCollection services) { - services.AddSingleton(); + services.AddScoped(); services.AddMediatR(options => { diff --git a/Src/RCommon.Mediatr/MediatRBuilderExtensions.cs b/Src/RCommon.Mediatr/MediatRBuilderExtensions.cs index 41743504..7e5f9e24 100644 --- a/Src/RCommon.Mediatr/MediatRBuilderExtensions.cs +++ b/Src/RCommon.Mediatr/MediatRBuilderExtensions.cs @@ -22,20 +22,20 @@ public static void AddNotification(this IMediatRBuilder builde where T : class, IAppNotification where TEventHandler : class, ISubscriber { - builder.Services.AddTransient, TEventHandler>(); + builder.Services.AddScoped, TEventHandler>(); // For notifications which can be handled by multiple handlers - builder.Services.AddTransient>, MediatRNotificationHandler>>(); + builder.Services.AddScoped>, MediatRNotificationHandler>>(); } public static void AddRequest(this IMediatRBuilder builder) where TRequest : class, IAppRequest where TEventHandler : class, IAppRequestHandler { - builder.Services.AddTransient, TEventHandler>(); + builder.Services.AddScoped, TEventHandler>(); // For requests which only have one endpoint. This should only be raised if we use the IMediator.Send method - builder.Services.AddTransient>, + builder.Services.AddScoped>, MediatRRequestHandler>>(); } @@ -44,26 +44,26 @@ public static void AddRequest(this IMediatRB where TResponse : class where TEventHandler : class, IAppRequestHandler { - builder.Services.AddTransient, TEventHandler>(); + builder.Services.AddScoped, TEventHandler>(); // For requests which only have one endpoint. This should only be raised if we use the IMediator.Send method - builder.Services.AddTransient, TResponse>, + builder.Services.AddScoped, TResponse>, MediatRRequestHandler, TResponse>>(); } public static void AddLoggingToRequestPipeline(this IMediatRBuilder builder) { - builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>)); + builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>)); } public static void AddValidationToRequestPipeline(this IMediatRBuilder builder) { - builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidatorBehavior<,>)); + builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(ValidatorBehavior<,>)); } public static void AddUnitOfWorkToRequestPipeline(this IMediatRBuilder builder) { - builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(UnitOfWorkBehavior<,>)); + builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(UnitOfWorkBehavior<,>)); } } diff --git a/Src/RCommon.Mediatr/MediatREventHandlingBuilder.cs b/Src/RCommon.Mediatr/MediatREventHandlingBuilder.cs index 8d33ad90..4e4bb60f 100644 --- a/Src/RCommon.Mediatr/MediatREventHandlingBuilder.cs +++ b/Src/RCommon.Mediatr/MediatREventHandlingBuilder.cs @@ -27,7 +27,7 @@ public MediatREventHandlingBuilder(IRCommonBuilder builder) protected void RegisterServices(IServiceCollection services) { - services.AddSingleton(); + services.AddScoped(); } public IServiceCollection Services { get; } diff --git a/Src/RCommon.Mediatr/MediatREventHandlingBuilderExtensions.cs b/Src/RCommon.Mediatr/MediatREventHandlingBuilderExtensions.cs index cfb7b287..427d14cd 100644 --- a/Src/RCommon.Mediatr/MediatREventHandlingBuilderExtensions.cs +++ b/Src/RCommon.Mediatr/MediatREventHandlingBuilderExtensions.cs @@ -40,7 +40,7 @@ public static IRCommonBuilder WithEventHandling(this IRCommonBuilder builder, Action mediatRActions) where T : IMediatREventHandlingBuilder { - builder.Services.AddTransient(); + builder.Services.AddScoped(); // MediatR builder.Services.AddMediatR(mediatRActions); @@ -56,10 +56,10 @@ public static void AddSubscriber(this IMediatREventHandli where TEvent : class, ISerializableEvent where TEventHandler : class, ISubscriber { - builder.Services.AddTransient, TEventHandler>(); + builder.Services.AddScoped, TEventHandler>(); // For notifications which can be handled by multiple handlers - builder.Services.AddTransient>, MediatREventHandler>>(); + builder.Services.AddScoped>, MediatREventHandler>>(); } } } diff --git a/Src/RCommon.Mediatr/RCommon.MediatR.csproj b/Src/RCommon.Mediatr/RCommon.MediatR.csproj index 5a036907..1c4257a1 100644 --- a/Src/RCommon.Mediatr/RCommon.MediatR.csproj +++ b/Src/RCommon.Mediatr/RCommon.MediatR.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Models/RCommon.Models.csproj b/Src/RCommon.Models/RCommon.Models.csproj index 1c193f68..a1088881 100644 --- a/Src/RCommon.Models/RCommon.Models.csproj +++ b/Src/RCommon.Models/RCommon.Models.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Persistence/PersistenceBuilderExtensions.cs b/Src/RCommon.Persistence/PersistenceBuilderExtensions.cs index 32db2c02..92fc9f31 100644 --- a/Src/RCommon.Persistence/PersistenceBuilderExtensions.cs +++ b/Src/RCommon.Persistence/PersistenceBuilderExtensions.cs @@ -68,7 +68,7 @@ public static IRCommonBuilder WithPersistence(this I /// Updated instance of RCommon Configuration private static IRCommonBuilder WithChangeTracking(this IRCommonBuilder config) { - config.Services.AddTransient(); + config.Services.AddScoped(); config.Services.AddScoped(); return config; } diff --git a/Src/RCommon.Persistence/RCommon.Persistence.csproj b/Src/RCommon.Persistence/RCommon.Persistence.csproj index 296299c3..8dfa4b78 100644 --- a/Src/RCommon.Persistence/RCommon.Persistence.csproj +++ b/Src/RCommon.Persistence/RCommon.Persistence.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Persistence/Transactions/DefaultUnitOfWorkBuilder.cs b/Src/RCommon.Persistence/Transactions/DefaultUnitOfWorkBuilder.cs index 12dc0130..9c515359 100644 --- a/Src/RCommon.Persistence/Transactions/DefaultUnitOfWorkBuilder.cs +++ b/Src/RCommon.Persistence/Transactions/DefaultUnitOfWorkBuilder.cs @@ -42,8 +42,8 @@ public DefaultUnitOfWorkBuilder(IServiceCollection services) services.AddScoped(); // Factory for Unit Of Work Scope - services.AddTransient(); - services.AddTransient(); + services.AddScoped(); + services.AddScoped(); _services = services; } diff --git a/Src/RCommon.Security/RCommon.Security.csproj b/Src/RCommon.Security/RCommon.Security.csproj index 44e8a77c..9c1c7607 100644 --- a/Src/RCommon.Security/RCommon.Security.csproj +++ b/Src/RCommon.Security/RCommon.Security.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.SendGrid/RCommon.SendGrid.csproj b/Src/RCommon.SendGrid/RCommon.SendGrid.csproj index 94b756bf..2f9fef49 100644 --- a/Src/RCommon.SendGrid/RCommon.SendGrid.csproj +++ b/Src/RCommon.SendGrid/RCommon.SendGrid.csproj @@ -14,7 +14,7 @@ RCommon, emailing, sendgrid true GitHub - 2.0.0.7 + 2.0.0.8 Apache-2.0 diff --git a/Src/RCommon.Web/RCommon.Web.csproj b/Src/RCommon.Web/RCommon.Web.csproj index df090c36..7fe23404 100644 --- a/Src/RCommon.Web/RCommon.Web.csproj +++ b/Src/RCommon.Web/RCommon.Web.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more. diff --git a/Src/RCommon.Wolverine/RCommon.Wolverine.csproj b/Src/RCommon.Wolverine/RCommon.Wolverine.csproj index 23e05bd1..e01887aa 100644 --- a/Src/RCommon.Wolverine/RCommon.Wolverine.csproj +++ b/Src/RCommon.Wolverine/RCommon.Wolverine.csproj @@ -2,7 +2,7 @@ net6.0;net7.0;net8.0; - 2.0.0.7 + 2.0.0.8 Jason Webb RCommon A cohesive set of infrastructure libraries for .NET 6, .NET 7, and .NET 8 that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more.