Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation

NES v5

NES (.NET Event Sourcing) is a lightweight framework that helps you build domain models when you're doing event sourcing.


If you're looking to take advantage of event sourcing on the .NET platform then you may also be looking to use NServiceBus and NEventStore. NES is an attempt to fill in the gaps between these two frameworks.


The code required to bring NServiceBus and NEventStore together isn't hard to write but it is important and it does have to work a certain way to take full advantage of both frameworks. There's some great resources out there already that help you write this yourself but ideally you'd want to concentrate on developing your domain model's behaviour rather than the infrastructure to glue these two frameworks together.


NES hooks into NServiceBus' and NEventStore's configuration objects and transparently takes care of everything for you. All you have to do is add two extra lines to your application's initialisation code.

Project Goals

  • Allow processing of messages sent in a batch as a single transaction (Ref)
  • Allow use of interfaces for events (Ref)
  • Allow up-conversion of events (Ref @ 36:00)
  • Automatic persistence of message headers
  • Automatic publishing of persisted events
  • Convention based event handling within aggregates
  • No 'Save()' methods on repositories
  • Minimal configuration

Version History


  • Supports NEventStore v5
  • Supports NServiceBus v5


  • Supports NEventStore v4
  • Supports NServiceBus v4


  • Supports EventStore v3
  • Supports NServiceBus v3


  • Supports EventStore v3
  • Supports NServiceBus v2


  • Supports EventStore v2
  • Supports NServiceBus v2


The easiest way to install NES is via NuGet (NES, NES.NEventStore, NES.NEventStore.Raven, NES.NServiceBus) or you can download the source and run 'build.bat' from the command line. Once built, the files will be placed in the 'build' folder.

Using NES until Version 4

public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, IWantCustomInitialization
	public void Init()


Using NES from version 5

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantToRunWhenBusStartsAndStops, IWantToRunWhenConfigurationIsComplete
        public void Init()

        public void Start()

        public void Stop()

        public void Customize(BusConfiguration configuration)

        public void Run(Configure config)

If you customize the BusConfiguration in a way, that you are defining which assemblies should be loading like following


so please ensure, that also all NES assemblies are loaded as well. You will get NullReferenceException if not doing so.

For a more complete example, please open and build NES.Sample.sln in Visual Studio and hit F5. This will start the NES.Sample NServiceBus endpoint as well as the NES.Sample.Web MVC3 website.

Need help? Found a bug? Have a question?

  • For guidance on how to use NES please take a look at the wiki pages.
  • If you have any problems using NES please submit a new issue.
  • Ask your question on Stack Overflow and tag your question with the CQRS tag and the word "NES" in the title.