main
1using Castle.Core.Interceptor;
2using MoMoney.Service.Infrastructure.Eventing;
3
4namespace momoney.service.infrastructure.threading
5{
6 public interface IRaiseEventInterceptor<Event> : IInterceptor where Event : IEvent, new()
7 {
8 }
9
10 public class RaiseEventInterceptor<Event> : IRaiseEventInterceptor<Event> where Event : IEvent, new()
11 {
12 readonly IEventAggregator broker;
13
14 public RaiseEventInterceptor(IEventAggregator broker)
15 {
16 this.broker = broker;
17 }
18
19 public void Intercept(IInvocation invocation)
20 {
21 invocation.Proceed();
22 broker.publish(new Event());
23 }
24 }
25}