public Repository(RepositoryConfig config) { _documentStore = new DocumentStore { Urls = new[] { config.ConnectionUrl }, Database = config.Database, Certificate = config.Certificate }; _documentStore.Initialize(); _database = _documentStore.Database; }
public Repository(RepositoryConfig config) { if (!string.IsNullOrEmpty(config.ConnectionStringName)) { _documentStore = new DocumentStore { ConnectionStringName = config.ConnectionStringName }; } else { _documentStore = new DocumentStore { Url = $"{config.ConnectionUrl.TrimEnd('/')}/databases/{config.Database}", ApiKey = config.ApiKey }; } _documentStore.Listeners.RegisterListener(new TakeNewestConflictResolutionListener()); _documentStore.Initialize(ensureDatabaseExists: false); _database = _documentStore.DefaultDatabase; }
public Repository(RepositoryConfig config) { _config = config; if (!string.IsNullOrEmpty(_config.ConnectionStringName)) { _documentStore = new DocumentStore { ConnectionStringName = _config.ConnectionStringName }; } else { _documentStore = new DocumentStore { Url = _config.ConnectionUrl, ApiKey = _config.ApiKey, DefaultDatabase = _config.Database }; } _documentStore.Listeners.RegisterListener(new TakeNewestConflictResolutionListener()); _documentStore.Initialize(); }