-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSoftawareCqsBuilder.cs
40 lines (35 loc) · 1.37 KB
/
SoftawareCqsBuilder.cs
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
34
35
36
37
38
39
40
using softaware.Cqs;
namespace SimpleInjector;
/// <summary>
/// Provides methods for configuring the softaware CQS infrastructure.
/// </summary>
public class SoftawareCqsBuilder
{
/// <summary>
/// The SimpleInjector container.
/// </summary>
public Container Container { get; }
/// <summary>
/// Initializes a new instance of the <see cref="SoftawareCqsBuilder"/> class.
/// </summary>
/// <param name="container">The SimpleInjector container.</param>
public SoftawareCqsBuilder(Container container)
{
this.Container = container;
}
/// <summary>
/// Enables decorators for the softaware CQS infrastructure.
/// </summary>
/// <remarks>
/// Decorators are applied in reverse order. This means decorators which are registered last will be executed first.
/// Decorators which are registered earlier will be executed "closer" to the actual handler.
/// </remarks>
/// <param name="softawareCqsDecoratorBuilderAction">Provides an action to configure decorators.</param>
/// <returns>The CQS builder.</returns>
public SoftawareCqsBuilder AddDecorators(Action<SoftawareCqsDecoratorBuilder> softawareCqsDecoratorBuilderAction)
{
var decoratorBuilder = new SoftawareCqsDecoratorBuilder(this.Container);
softawareCqsDecoratorBuilderAction.Invoke(decoratorBuilder);
return this;
}
}