-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSoftawareCqsTypesBuilder.cs
More file actions
38 lines (32 loc) · 1.08 KB
/
SoftawareCqsTypesBuilder.cs
File metadata and controls
38 lines (32 loc) · 1.08 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
38
using System.Reflection;
namespace softaware.Cqs;
/// <summary>
/// Provides a builder to configure registered assemblies.
/// </summary>
public class SoftawareCqsTypesBuilder
{
private readonly HashSet<Assembly> registeredAssemblies = new();
/// <summary>
/// Gets the already registered assemblies.
/// </summary>
public IReadOnlyCollection<Assembly> RegisteredAssemblies => this.registeredAssemblies;
/// <summary>
/// Registers the assemblies of the provided <paramref name="markerTypes"/>.
/// </summary>
public SoftawareCqsTypesBuilder IncludeTypesFrom(params Type[] markerTypes)
{
this.IncludeTypesFrom(markerTypes.Select(t => t.Assembly).ToArray());
return this;
}
/// <summary>
/// Registers the provided <paramref name="assemblies"/> for later CQS configuration.
/// </summary>
public SoftawareCqsTypesBuilder IncludeTypesFrom(params Assembly[] assemblies)
{
foreach (var assembly in assemblies)
{
this.registeredAssemblies.Add(assembly);
}
return this;
}
}