- Entity inherit from ICommand interface example UserCommand:ICommand
- handler should inherit from ICommandHandler Example UserCommandHandler:ICommandHandler write what you want to handler make
- you should inject your handler example : builder.Services .AddTransient<ICommandHandler, UserCommandHandler>();
- Entity inherit from IQuery interface example GetUserList : IQuery
- handler should inherit from IQueryHandler<Entity, EntityModel>> Example : GetUserListHandler : IQueryHandler<GetUserList, UserDTO> write what you want to handler make
- you should inject your handler example : builder.Services .AddTransient<IQueryHandler<GetUserList, UserDTO>, GetUserListHandler>();
you should inject cqrs service as this manager of pattern and by this can ship your service example builder.Services.AddSingleton();