-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSoftawareCqsBuilder.cs
More file actions
37 lines (32 loc) · 1.42 KB
/
SoftawareCqsBuilder.cs
File metadata and controls
37 lines (32 loc) · 1.42 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
34
35
36
37
namespace Microsoft.Extensions.DependencyInjection;
/// <summary>
/// Provides methods for configuring the softaware CQS infrastructure.
/// </summary>
public class SoftawareCqsBuilder
{
/// <summary>
/// The service collection.
/// </summary>
public IServiceCollection Services { get; }
/// <summary>
/// Initializes a new instance of the <see cref="SoftawareCqsBuilder"/> class.
/// </summary>
/// <param name="services">The service collection.</param>
public SoftawareCqsBuilder(IServiceCollection services) =>
this.Services = services ?? throw new ArgumentNullException(nameof(services));
/// <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.Services);
softawareCqsDecoratorBuilderAction.Invoke(decoratorBuilder);
return this;
}
}