C# Class Ncqrs.Eventing.Storage.SQL.MsSqlServerEventStore

Stores events for a SQL database.
Inheritance: IEventStore, ISnapshotStore
显示文件 Open project: SzymonPobiega/ncqrs Class Usage Examples

Public Methods

Method Description
GetAllEvents ( System.Guid id ) : IEnumerable

Get all event for a specific event provider.

GetAllEventsSinceVersion ( System.Guid id, long version ) : IEnumerable

Get all events provided by an specified event source.

GetAllIdsForType ( Type eventProviderType ) : IEnumerable
GetSnapshot ( System.Guid eventSourceId ) : ISnapshot

Gets a snapshot of a particular event source, if one exists. Otherwise, returns null.

GetTableCreationQueries ( ) : IEnumerable

Gets the table creation queries that can be used to create the tables that are needed for a database that is used as an event store.

This returns the content of the TableCreationScript.sql that is embedded as resource.

MsSqlServerEventStore ( String connectionString ) : System
MsSqlServerEventStore ( String connectionString, IPropertyBagConverter converter = null ) : System
RemoveUnusedProviders ( ) : void
Save ( IEventSource eventSource ) : void

Saves all events from an event provider.

SaveShapshot ( ISnapshot snapshot ) : void

Saves a snapshot of the specified event source.

Private Methods

Method Description
AddEventSource ( IEventSource eventSource, SqlTransaction transaction ) : void

Adds the event source to the event store.

GetVersion ( System.Guid providerId, SqlTransaction transaction ) : int?

Gets the version of the provider from the event store.

SaveEvent ( ISourcedEvent evnt, SqlTransaction transaction ) : void

Saves the event to the data store.

SaveEvents ( IEnumerable evnts, SqlTransaction transaction ) : void

Saves the events to the event store.

ToBinary ( object obj ) : byte[]
UpdateEventSourceVersion ( IEventSource eventSource, SqlTransaction transaction ) : void

Method Details

GetAllEvents() public method

Get all event for a specific event provider.
public GetAllEvents ( System.Guid id ) : IEnumerable
id System.Guid The id of the event provider.
return IEnumerable

GetAllEventsSinceVersion() public method

Get all events provided by an specified event source.
public GetAllEventsSinceVersion ( System.Guid id, long version ) : IEnumerable
id System.Guid
version long
return IEnumerable

GetAllIdsForType() public method

public GetAllIdsForType ( Type eventProviderType ) : IEnumerable
eventProviderType System.Type
return IEnumerable

GetSnapshot() public method

Gets a snapshot of a particular event source, if one exists. Otherwise, returns null.
public GetSnapshot ( System.Guid eventSourceId ) : ISnapshot
eventSourceId System.Guid
return ISnapshot

GetTableCreationQueries() public static method

Gets the table creation queries that can be used to create the tables that are needed for a database that is used as an event store.
This returns the content of the TableCreationScript.sql that is embedded as resource.
public static GetTableCreationQueries ( ) : IEnumerable
return IEnumerable

MsSqlServerEventStore() public method

public MsSqlServerEventStore ( String connectionString ) : System
connectionString String
return System

MsSqlServerEventStore() public method

public MsSqlServerEventStore ( String connectionString, IPropertyBagConverter converter = null ) : System
connectionString String
converter IPropertyBagConverter
return System

RemoveUnusedProviders() public method

public RemoveUnusedProviders ( ) : void
return void

Save() public method

Saves all events from an event provider.
public Save ( IEventSource eventSource ) : void
eventSource IEventSource
return void

SaveShapshot() public method

Saves a snapshot of the specified event source.
public SaveShapshot ( ISnapshot snapshot ) : void
snapshot ISnapshot
return void