public EventDocumentStorage(StoreOptions options) { Events = options.EventGraph; _mapping = new EventQueryMapping(options); FromObject = _mapping.TableName.QualifiedName; Fields = _mapping; _serializer = options.Serializer(); IdType = Events.StreamIdentity == StreamIdentity.AsGuid ? typeof(Guid) : typeof(string); TenancyStyle = options.Events.TenancyStyle; // The json data column has to go first var table = new EventsTable(Events); var columns = table.SelectColumns(); _fields = columns.Select(x => x.Name).ToArray(); _selectClause = $"select {_fields.Join(", ")} from {Events.DatabaseSchemaName}.mt_events as d"; _defaultWhere = Events.TenancyStyle == TenancyStyle.Conjoined ? CompoundWhereFragment.And(IsNotArchivedFilter.Instance, CurrentTenantFilter.Instance) : IsNotArchivedFilter.Instance; }
public EventDocumentStorage(EventGraph graph, EventQueryMapping mapping, ISerializer serializer) { _graph = graph; _mapping = mapping; FromObject = _mapping.Table.QualifiedName; Fields = mapping; if (graph.StreamIdentity == StreamIdentity.AsGuid) { IdType = typeof(Guid); _selector = new EventSelector(graph, serializer); } else { IdType = typeof(string); _selector = new StringIdentifiedEventSelector(graph, serializer); } }
public EventDocumentStorage(StoreOptions options) { Events = options.Events; _mapping = new EventQueryMapping(options); FromObject = _mapping.TableName.QualifiedName; Fields = _mapping; _serializer = options.Serializer(); IdType = Events.StreamIdentity == StreamIdentity.AsGuid ? typeof(Guid) : typeof(string); // The json data column has to go first var table = new EventsTable(Events); var columns = table.SelectColumns(); _fields = columns.Select(x => x.Name).ToArray(); _selectClause = $"select {_fields.Join(", ")} from {Events.DatabaseSchemaName}.mt_events as d"; }