We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
下面为伪代码:
namespace NetCorePal.Extensions.Primitives; public interface IQuery; public interface IQuery<out TResponse> : IRequest<TResponse>, IQuery; public interface IQueryHandler<in TQuery, TResponse> : IRequestHandler<TQuery, TResponse> where TQuery : IQuery<TResponse> { } public class DbContext() { } public class OrderQueryResponse { public required string Title { get; set; } public required string Description { get; set; } public decimal Price { get; set; } } public record OrderQueryRequest(string Title) : IQuery<OrderQueryResponse>; public class OrderQueryHandler(DbContext dbContext) : IQueryHandler<OrderQueryRequest, OrderQueryResponse> { public Task<OrderQueryResponse> Handle(OrderQueryRequest request, CancellationToken cancellationToken) { return Task.FromResult(new OrderQueryResponse { Title = request.Title, Description = "Description", Price = 100 }); } } public class OrderQuery(DbContext dbcontext) : IQuery { public Task<OrderQueryResponse> QueryQrder(OrderQueryRequest request, CancellationToken cancellationToken) { return Task.FromResult(new OrderQueryResponse { Title = request.Title, Description = "Description", Price = 100 }); } public Task<OrderQueryResponse> QueryOrderByTitle(string title, CancellationToken cancellationToken) { return Task.FromResult(new OrderQueryResponse { Title = request.Title, Description = "Description", Price = 100 }); } }
The text was updated successfully, but these errors were encountered:
在#99中实现
Sorry, something went wrong.
No branches or pull requests
下面为伪代码:
The text was updated successfully, but these errors were encountered: