示例#1
0
        private DocumentStore InitStore(TenancyStyle tenancyStyle, bool cleanSchema = true, bool useAppendEventForUpdateLock = false)
        {
            var databaseSchema = $"end_to_end_event_capture_{tenancyStyle.ToString().ToLower()}";

            var store = StoreOptions(_ =>
            {
                _.Events.DatabaseSchemaName          = databaseSchema;
                _.Events.TenancyStyle                = tenancyStyle;
                _.Events.UseAppendEventForUpdateLock = useAppendEventForUpdateLock;

                _.AutoCreateSchemaObjects = AutoCreate.All;

                if (tenancyStyle == TenancyStyle.Conjoined)
                {
                    _.Policies.AllDocumentsAreMultiTenanted();
                }

                _.Connection(ConnectionSource.ConnectionString);

                _.Events.Projections.InlineSelfAggregate <QuestParty>();

                _.Events.AddEventType(typeof(MembersJoined));
                _.Events.AddEventType(typeof(MembersDeparted));
                _.Events.AddEventType(typeof(QuestStarted));
            }, cleanSchema);


            return(store);
        }
示例#2
0
        private static DocumentStore InitStore(TenancyStyle tenancyStyle, bool cleanShema = true, bool useAppendEventForUpdateLock = false)
        {
            var databaseSchema = $"end_to_end_event_capture_{tenancyStyle.ToString().ToLower()}";

            var store = DocumentStore.For(_ =>
            {
                _.Events.DatabaseSchemaName          = databaseSchema;
                _.Events.TenancyStyle                = tenancyStyle;
                _.Events.UseAppendEventForUpdateLock = useAppendEventForUpdateLock;

                _.AutoCreateSchemaObjects = AutoCreate.All;

                if (tenancyStyle == TenancyStyle.Conjoined)
                {
                    _.Policies.AllDocumentsAreMultiTenanted();
                }

                _.Connection(ConnectionSource.ConnectionString);

                _.Events.InlineProjections.AggregateStreamsWith <QuestParty>();

                _.Events.AddEventType(typeof(MembersJoined));
                _.Events.AddEventType(typeof(MembersDeparted));
                _.Events.AddEventType(typeof(QuestStarted));
            });

            if (cleanShema)
            {
                store.Advanced.Clean.CompletelyRemoveAll();
            }

            return(store);
        }
示例#3
0
        private void InitStore(TenancyStyle tenancyStyle, StreamIdentity streamIdentity = StreamIdentity.AsGuid)
        {
            var databaseSchema = $"{GetType().Name}_{tenancyStyle.ToString().ToLower()}";

            StoreOptions(_ =>
            {
                _.Events.DatabaseSchemaName = databaseSchema;
                _.Events.TenancyStyle       = tenancyStyle;
                _.Events.StreamIdentity     = streamIdentity;
                _.Policies.AllDocumentsAreMultiTenanted();
            });
        }
示例#4
0
        private void InitStore(TenancyStyle tenancyStyle, StreamIdentity streamIdentity = StreamIdentity.AsGuid)
        {
            var databaseSchema = $"{GetType().Name}_{tenancyStyle.ToString().ToLower()}_{streamIdentity}";

            using var conn = new NpgsqlConnection(ConnectionSource.ConnectionString);
            conn.Open();
            conn.DropSchema(databaseSchema).GetAwaiter().GetResult();

            StoreOptions(_ =>
            {
                _.Events.DatabaseSchemaName = databaseSchema;
                _.Events.TenancyStyle       = tenancyStyle;
                _.Events.StreamIdentity     = streamIdentity;
                _.Policies.AllDocumentsAreMultiTenanted();
            });
        }