Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using MediatR;
- using System;
- using System.Threading;
- using System.Threading.Tasks;
- namespace CA.Application.CompanyContext.Queries.DummyQuery
- {
- public class DummyRequest_1 : IRequest<bool>{ }
- public class DummyRequest_2 : IRequest<string> { }
- public abstract class AbstractDummyQueryHandler<TRequest, TResponse>
- : IRequestHandler<TRequest, TResponse>
- where TRequest : IRequest<TResponse>
- {
- public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken)
- {
- //same code stuffs here
- //same code stuffs here
- //same code stuffs here
- //same code stuffs here
- //same code stuffs here
- return Task.FromResult(GetViewModel());
- }
- public abstract TResponse GetViewModel();
- }
- public class DummyQueryHandler_1 : AbstractDummyQueryHandler<DummyRequest_1, bool>
- {
- public override bool GetViewModel()
- {
- throw new NotImplementedException();
- }
- }
- public class DummyQueryHandler_2 : AbstractDummyQueryHandler<DummyRequest_2, string>
- {
- public override string GetViewModel()
- {
- throw new NotImplementedException();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement