private IDocumentStore InitDocumentStore(AutofacCreationConverter converter) { IDocumentStore ds; if (_ds != null) { ds = _ds; } else if (ConnectionStringName != null) { ds = new DocumentStore { ConnectionStringName = ConnectionStringName, ResourceManagerId = Guid.NewGuid() }; ds.Initialize(); } else if (!string.IsNullOrEmpty(Url)) { var store = new DocumentStore { Url = Url, ResourceManagerId = Guid.NewGuid() }; if (!string.IsNullOrEmpty(DefaultDatabase)) { store.DefaultDatabase = DefaultDatabase; } store.Initialize(); ds = store; } else { ds = new DocumentStore { Url = "http://localhost:9901", ResourceManagerId = Guid.NewGuid() }; ds.Initialize(); } if (converter != null && UseCreationConverter) { ds.Conventions.CustomizeJsonSerializer += s => s.Converters.Add(converter); } ds.Conventions.DisableProfiling = true; ds.Conventions.JsonContractResolver = new RecordClrTypeInJsonContractResolver(); ds.Conventions.CustomizeJsonSerializer += s => s.TypeNameHandling = TypeNameHandling.Arrays; if (CreateIndexes) { IndexCreation.CreateIndexes(ThisAssembly, ds); } //ds.DatabaseCommands.EnsureDatabaseExists() //global::Raven.Client.Indexes.IndexCreation.CreateIndexes(typeof(RegionTrajectoryIndex).Assembly, ds); return(ds); }
private IDocumentStore InitDocumentStore(AutofacCreationConverter converter) { IDocumentStore ds; if (_ds != null) ds = _ds; else if (ConnectionStringName != null) { ds = new DocumentStore { ConnectionStringName = ConnectionStringName, ResourceManagerId = Guid.NewGuid() }; ds.Initialize(); } else if (!string.IsNullOrEmpty(Url)) { var store = new DocumentStore { Url = Url, ResourceManagerId = Guid.NewGuid() }; if (!string.IsNullOrEmpty(DefaultDatabase)) store.DefaultDatabase = DefaultDatabase; store.Initialize(); ds = store; } else { ds = new DocumentStore { Url = "http://localhost:9901", ResourceManagerId = Guid.NewGuid() }; ds.Initialize(); } if (converter != null && UseCreationConverter) { ds.Conventions.CustomizeJsonSerializer += s => s.Converters.Add(converter); } ds.Conventions.DisableProfiling = true; ds.Conventions.JsonContractResolver = new RecordClrTypeInJsonContractResolver(); ds.Conventions.CustomizeJsonSerializer += s => s.TypeNameHandling = TypeNameHandling.Arrays; if (CreateIndexes) { IndexCreation.CreateIndexes(ThisAssembly, ds); } //ds.DatabaseCommands.EnsureDatabaseExists() //global::Raven.Client.Indexes.IndexCreation.CreateIndexes(typeof(RegionTrajectoryIndex).Assembly, ds); return ds; }