-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The EventStore is a persistence library for .NET used to abstract different storage implementations when using event sourcing as storage mechanism. Event sourcing is most closely associated with a concept known as CQRS.
Get the EventStore from NuGet (stable) or MyGet (CI builds, unstable).
var store = Wireup.Init()
.UsingSqlPersistence("Name Of EventStore ConnectionString In Config File")
.InitializeStorageEngine()
.UsingJsonSerialization()
.Compress()
.EncryptWith(EncryptionKey)
.HookIntoPipelineUsing(new[] { new AuthorizationPipelineHook() })
.UsingAsynchronousDispatchScheduler()
// Example of NServiceBus dispatcher: https://gist.github.com/1311195
.DispatchTo(new My_NServiceBus_Or_MassTransit_OrEven_WCF_Adapter_Code())
.Build();
/* NOTE: This following is merely *example* code. */
using (store)
{
// some business code here
using (var stream = store.CreateStream(myMessage.CustomerId))
{
stream.Add(new EventMessage { Body = myMessage });
stream.CommitChanges(myMessage.MessageId);
}
using (var stream = store.OpenStream(myMessage.CustomerId, 0, int.MaxValue))
{
foreach (var @event in stream.CommittedEvents)
{
// business processing...
}
}
}For a more complete example, please see EventStore.Example. The EventStore.Example project is configured by default to use a SQL event store. To run the example program, either change the SQL connection string in the app.config file to connect to a existing SQL database or change WireupEventStore() to call UsingInMemoryPersistence() rather than UsingSqlPersistence().
Ask your question on Stack Overflow and tag your question with the CQRS tag and the word "EventStore" in the title.
- Mono 2.4 support
- Medium-trust support
- Support more storage engines than any other event storage implementation
- Easily support virtually any storage engine (NoSQL, etc.)
- Avoid dependence upon TransactionScope or Transactions while maintaining full data integrity
- Full test coverage of storage implementations
- Easily hook into any bus implementation (NServiceBus, MassTransit, etc.)
- Synchronous and asynchronous dispatching of events
- Extreme performance
- Multi-thread safe
- Fluent builder
Simply run build.cmd from the command line. Once built, the files will be placed in the "publish-net40" subdirectory.