Skip to content

Commit

Permalink
Add CQRS omterfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalis committed Aug 1, 2023
1 parent 3a7b4db commit c86329b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Ardalis.SharedKernel/Ardalis.SharedKernel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<RepositoryUrl>https://github.com/ardalis/Ardalis.SharedKernel</RepositoryUrl>
<PackageTags>DDD;Shared Kernel;SharedKernel;Domain-Driven Design;Repository;Specification;ValueObject;Value Object;Ardalis;Clean;Clean Architecture;Clean Architecture Template</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
<PackageReleaseNotes>
* Add MediatR Domain Event Dispatcher
* Add Commands, Queries, and Handler interfaces
</PackageReleaseNotes>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand Down
11 changes: 11 additions & 0 deletions src/Ardalis.SharedKernel/ICommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using MediatR;

namespace Ardalis.SharedKernel;

/// <summary>
/// Source: https://code-maze.com/cqrs-mediatr-fluentvalidation/
/// </summary>
/// <typeparam name="TResponse"></typeparam>
public interface ICommand<out TResponse> : IRequest<TResponse>
{
}
13 changes: 13 additions & 0 deletions src/Ardalis.SharedKernel/ICommandHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using MediatR;

namespace Ardalis.SharedKernel;

/// <summary>
/// Source: https://code-maze.com/cqrs-mediatr-fluentvalidation/
/// </summary>
/// <typeparam name="TCommand"></typeparam>
/// <typeparam name="TResponse"></typeparam>
public interface ICommandHandler<in TCommand, TResponse> : IRequestHandler<TCommand, TResponse>
where TCommand : ICommand<TResponse>
{
}
11 changes: 11 additions & 0 deletions src/Ardalis.SharedKernel/IQuery.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using MediatR;

namespace Ardalis.SharedKernel;

/// <summary>
/// Source: https://code-maze.com/cqrs-mediatr-fluentvalidation/
/// </summary>
/// <typeparam name="TResponse"></typeparam>
public interface IQuery<out TResponse> : IRequest<TResponse>
{
}
13 changes: 13 additions & 0 deletions src/Ardalis.SharedKernel/IQueryHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using MediatR;

namespace Ardalis.SharedKernel;

/// <summary>
/// Source: https://code-maze.com/cqrs-mediatr-fluentvalidation/
/// </summary>
/// <typeparam name="TQuery"></typeparam>
/// <typeparam name="TResponse"></typeparam>
public interface IQueryHandler<in TQuery, TResponse> : IRequestHandler<TQuery, TResponse>
where TQuery : IQuery<TResponse>
{
}

0 comments on commit c86329b

Please sign in to comment.