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); }
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); }
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(); }); }
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(); }); }