Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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";
        }