https://github.com/dario-l/ses
SimpleEventStore is a simple event store library for .NET based on rdbms persistance.
https://github.com/dario-l/ses
cqrs cqrs-es event-sourcing event-store event-stream ms-sql-server rdbms sql streams
Last synced: 6 months ago
JSON representation
SimpleEventStore is a simple event store library for .NET based on rdbms persistance.
- Host: GitHub
- URL: https://github.com/dario-l/ses
- Owner: dario-l
- License: mit
- Archived: true
- Created: 2016-07-28T08:45:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T12:26:50.000Z (over 5 years ago)
- Last Synced: 2025-01-15T01:18:36.355Z (about 1 year ago)
- Topics: cqrs, cqrs-es, event-sourcing, event-store, event-stream, ms-sql-server, rdbms, sql, streams
- Language: C#
- Homepage:
- Size: 1.39 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**Ses is dead. Long live https://github.com/getmanta/manta **
*...but is still used in production code.*
# SimpleEventStore
 SimpleEventStore
 SimpleEventStore.Abstracts
 SimpleEventStore.Domain
 SimpleEventStore.MsSql
 SimpleEventStore.Subscriptions
 SimpleEventStore.Subscriptions.MsSql
SimpleEventStore is a simple event store library for .NET based on rdbms persistance.
##### Main goals
- Async all the way down (sync methods also available)
- No external dependencies
- Pluggable persistance storage
- Support optimistic (and pesimistic for special cases) concurrency with conflict resolver mechanism
- Support any kind of serialization through ISerializer interface
- Support any kind of loggers through ILogger interface
- Support up-conversion of events/snapshots to the newest version
- Subscriptions to one or many event stream sources for processmanagers/projections/others (with pluggable stream pollers)
- Built-in implementation for: MS SQL Server, InMemory
- Built-in single-writer pattern for MS SQL Server implementation (Linearizer)
##### Basic example of usage
``` c#
var options = new TransactionOptions {IsolationLevel = IsolationLevel.ReadCommitted};
using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew, options, TransactionScopeAsyncFlowOption.Enabled))
{
var aggregate = new ShoppingCart();
aggregate.AddItem(SequentalGuid.NewGuid(), name: "Product 1", quantity: 3);
var stream = new EventStream(id, aggregate.TakeUncommittedEvents());
// Adding metadata item (key, value)
stream.Metadata = new Dictionary
{
{ "RequestIP", "0.0.0.0" },
{ "User", "John Doe" }
};
var expectedVersion = aggregate.CommittedVersion + stream.Events.Count;
await _store.SaveChangesAsync(aggregate.Id, expectedVersion, stream);
scope.Complete();
}
```
Using repository pattern:
``` c#
// Usually transaction scope will be hidden somewhere in infrastructural part of code
using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew, options, TransactionScopeAsyncFlowOption.Enabled))
{
using (var repo = new SourcedRepo(store))
{
// Open stream and restore aggregate from history
var aggregate = await repo.LoadAsync(id);
aggregate.AddItem(Guid.NewGuid(), "Product 1", 3);
await repo.SaveChangesAsync(aggregate);
}
scope.Complete();
}
```
##### It is working on production already
SimpleEventStore has used in commercial project https://timeharmony.pl already.