-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSoftawareCqsTransactionDecoratorBuilderExtensions.cs
More file actions
33 lines (28 loc) · 1.28 KB
/
SoftawareCqsTransactionDecoratorBuilderExtensions.cs
File metadata and controls
33 lines (28 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using softaware.Cqs.Decorators.Transaction;
namespace Microsoft.Extensions.DependencyInjection;
/// <summary>
/// Provides extension methods to add transaction aware decorators.
/// </summary>
public static class SoftawareCqsTransactionDecoratorBuilderExtensions
{
/// <summary>
/// Registers the transaction aware command handler decorator.
/// </summary>
/// <param name="decoratorBuilder">The CQS decorator builder.</param>
/// <returns>The CQS decorator builder.</returns>
public static SoftawareCqsDecoratorBuilder AddTransactionCommandHandlerDecorator(this SoftawareCqsDecoratorBuilder decoratorBuilder)
{
decoratorBuilder.AddRequestHandlerDecorator(typeof(TransactionAwareCommandHandlerDecorator<,>));
return decoratorBuilder;
}
/// <summary>
/// Registers the transaction aware query handler decorator.
/// </summary>
/// <param name="decoratorBuilder">The CQS decorator builder.</param>
/// <returns>The CQS decorator builder.</returns>
public static SoftawareCqsDecoratorBuilder AddTransactionQueryHandlerDecorator(this SoftawareCqsDecoratorBuilder decoratorBuilder)
{
decoratorBuilder.AddRequestHandlerDecorator(typeof(TransactionAwareQueryHandlerDecorator<,>));
return decoratorBuilder;
}
}