-
Notifications
You must be signed in to change notification settings - Fork 6
/
CoreDddInstaller.cs
42 lines (38 loc) · 1.42 KB
/
CoreDddInstaller.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
41
42
using Castle.Facilities.TypedFactory;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using CoreDdd.Commands;
using CoreDdd.Domain.Events;
using CoreDdd.Queries;
namespace CoreDdd.Register.Castle
{
/// <summary>
/// Registers CoreDdd services into Castle Windsor IoC container.
/// </summary>
public class CoreDddInstaller : IWindsorInstaller
{
/// <summary>
/// Registers the services.
/// </summary>
/// <param name="container">Castle Windsor container</param>
/// <param name="store">Castle Windsor configuration store</param>
public void Install(IWindsorContainer container, IConfigurationStore store)
{
AddTypedFactoryFacilityHelper.TryAddTypedFactoryFacility(container);
container.Register(
Component.For<ICommandHandlerFactory>().AsFactory(),
Component.For<ICommandExecutor>()
.ImplementedBy<CommandExecutor>()
.LifeStyle.Transient);
container.Register(
Component.For<IQueryHandlerFactory>().AsFactory(),
Component.For<IQueryExecutor>()
.ImplementedBy<QueryExecutor>()
.LifeStyle.Transient);
container.Register(
Component.For<IDomainEventHandlerFactory>().AsFactory()
);
}
}
}