/// <summary> /// Creates a new DocumentStore with the supplied StoreOptions /// </summary> /// <param name="options"></param> public DocumentStore(StoreOptions options) { options.ApplyConfiguration(); options.CreatePatching(); options.Validate(); Options = options; _logger = options.Logger(); Serializer = options.Serializer(); _retryPolicy = options.RetryPolicy(); if (options.CreateDatabases != null) { IDatabaseGenerator databaseGenerator = new DatabaseGenerator(); databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases); } Tenancy.Initialize(); Schema = Tenancy.Schema; Storage.PostProcessConfiguration(); Advanced = new AdvancedOptions(this); Diagnostics = new Diagnostics(this); Transform = new DocumentTransforms(this, Tenancy.Default); options.InitialData.Each(x => x.Populate(this)); }
public DocumentStore(StoreOptions options) { options.ApplyConfiguration(); options.Validate(); Options = options; _logger = options.Logger(); Serializer = options.Serializer(); if (options.CreateDatabases != null) { IDatabaseGenerator databaseGenerator = new DatabaseGenerator(); databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases); } Schema = Tenancy.Default.Database; Storage.PostProcessConfiguration(); Events.AssertValidity(this); Options.Projections.AssertValidity(this); Advanced = new AdvancedOperations(this); Diagnostics = new Diagnostics(this); if (Options.GeneratedCodeMode == TypeLoadMode.LoadFromPreBuiltAssembly) { var rules = new GenerationRules(SchemaConstants.MartenGeneratedNamespace); Events.As <IGeneratesCode>().AttachPreBuiltTypes(rules, Assembly.GetEntryAssembly(), null); Options.As <IGeneratesCode>().AttachPreBuiltTypes(rules, Assembly.GetEntryAssembly(), null); } options.InitialData.Each(x => x.Populate(this).GetAwaiter().GetResult()); }
public DocumentStore(StoreOptions options) { options.ApplyConfiguration(); options.Validate(); Options = options; _logger = options.Logger(); Serializer = options.Serializer(); _retryPolicy = options.RetryPolicy(); if (options.CreateDatabases != null) { IDatabaseGenerator databaseGenerator = new DatabaseGenerator(); databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases); } //Tenancy.Initialize(); Schema = Tenancy.Schema; Storage.PostProcessConfiguration(); Events.AssertValidity(this); Options.Projections.AssertValidity(this); Advanced = new AdvancedOperations(this); Diagnostics = new Diagnostics(this); options.InitialData.Each(x => x.Populate(this).GetAwaiter().GetResult()); }
/// <summary> /// Creates a new DocumentStore with the supplied StoreOptions /// </summary> /// <param name="options"></param> public DocumentStore(StoreOptions options) { options.ApplyConfiguration(); options.CreatePatching(); options.Validate(); Options = options; _logger = options.Logger(); Tenancy = options.Tenancy; if (options.CreateDatabases != null) { IDatabaseGenerator databaseGenerator = new DatabaseGenerator(); databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases); } Tenancy.Initialize(); Schema = Tenancy.Schema; Storage = options.Storage; Storage.PostProcessConfiguration(); Serializer = options.Serializer(); if (options.UseCharBufferPooling) { _writerPool = new CharArrayTextWriter.Pool(); } Advanced = new AdvancedOptions(this); Diagnostics = new Diagnostics(this); Transform = new DocumentTransforms(this, Tenancy.Default); options.InitialData.Each(x => x.Populate(this)); Parser = new MartenExpressionParser(Serializer, options); HandlerFactory = new QueryHandlerFactory(this); Events = options.Events; }
/// <summary> /// Creates a new DocumentStore with the supplied StoreOptions /// </summary> /// <param name="options"></param> public DocumentStore(StoreOptions options) { options.ApplyConfiguration(); options.CreatePatching(); options.Validate(); Options = options; _logger = options.Logger(); Serializer = options.Serializer(); _retryPolicy = options.RetryPolicy(); if (options.CreateDatabases != null) { IDatabaseGenerator databaseGenerator = new DatabaseGenerator(); databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases); } Tenancy.Initialize(); Schema = Tenancy.Schema; Storage.PostProcessConfiguration(); _writerPool = options.UseCharBufferPooling ? MemoryPool <char> .Shared : new AllocatingMemoryPool <char>(); Advanced = new AdvancedOptions(this); Diagnostics = new Diagnostics(this); Transform = new DocumentTransforms(this, Tenancy.Default); Parser = new MartenExpressionParser(Serializer, options); HandlerFactory = new QueryHandlerFactory(this); options.InitialData.Each(x => x.Populate(this)); }
public DocumentStore(StoreOptions options) { options.ApplyConfiguration(); options.Validate(); Options = options; _logger = options.Logger(); Serializer = options.Serializer(); // Workaround to make database creation lazy so all StoreOptions // customizations can be done first if (Tenancy is DefaultTenancy d) { d.Initialize(); } if (options.CreateDatabases != null) { IDatabaseGenerator databaseGenerator = new DatabaseGenerator(); databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases); } StorageFeatures.PostProcessConfiguration(); Events.AssertValidity(this); Options.Projections.AssertValidity(this); Advanced = new AdvancedOperations(this); Diagnostics = new Diagnostics(this); _lightweightCompiledQueries = new CompiledQueryCollection(DocumentTracking.None, this); _identityMapCompiledQueries = new CompiledQueryCollection(DocumentTracking.IdentityOnly, this); _dirtyTrackedCompiledQueries = new CompiledQueryCollection(DocumentTracking.DirtyTracking, this); _queryOnlyCompiledQueries = new CompiledQueryCollection(DocumentTracking.QueryOnly, this); }