From 64f6d0278f25e13d22b2b1672da3620d92755160 Mon Sep 17 00:00:00 2001 From: Dennis Traub Date: Wed, 19 Oct 2011 18:13:41 +0200 Subject: [PATCH] Added Ncqrs.Eventing.EventServiceMappedByConvention as a to provide out-of-context event publishing capabilities --- .../EventServiceMappedByConvention.cs | 19 +++++++++++++++++++ Framework/src/Ncqrs/Ncqrs.csproj | 1 + 2 files changed, 20 insertions(+) create mode 100644 Framework/src/Ncqrs/Eventing/EventServiceMappedByConvention.cs diff --git a/Framework/src/Ncqrs/Eventing/EventServiceMappedByConvention.cs b/Framework/src/Ncqrs/Eventing/EventServiceMappedByConvention.cs new file mode 100644 index 00000000..cb482145 --- /dev/null +++ b/Framework/src/Ncqrs/Eventing/EventServiceMappedByConvention.cs @@ -0,0 +1,19 @@ +using System; +using Ncqrs.Domain; +using Ncqrs.Eventing.Sourcing; + +namespace Ncqrs.Eventing +{ + public abstract class EventServiceMappedByConvention : AggregateRootMappedByConvention + { + public void Raise(ISourcedEvent e) + { + var factory = NcqrsEnvironment.Get(); + var context = factory.CreateUnitOfWork(e.EventIdentifier); + + ApplyEvent(e); + + context.Accept(); + } + } +} \ No newline at end of file diff --git a/Framework/src/Ncqrs/Ncqrs.csproj b/Framework/src/Ncqrs/Ncqrs.csproj index 18f1a7a0..7c8ff752 100644 --- a/Framework/src/Ncqrs/Ncqrs.csproj +++ b/Framework/src/Ncqrs/Ncqrs.csproj @@ -125,6 +125,7 @@ +