/// <summary> /// initialises the storage path provider /// </summary> public StoragePathProvider(IProvideApplicationSettings settings) { It.IsNull(settings) .AsGuard <ArgumentNullException>(nameof(settings)); Settings = settings; DocumentStoreID = Settings.GetVariable(DocumentStoreIDKey); LocalAuthorityCollectionID = Settings.GetVariable(LocalAuthorityCollectionIDKey); LocalAuthorityCollection = UriFactory.CreateDocumentCollectionUri(DocumentStoreID, LocalAuthorityCollectionID); }
/// <summary> /// initialises an instance of the <see cref="DocumentStore"/> /// </summary> /// <param name="usingEnvironment">using environment variables</param> public DocumentStore( IProvideApplicationSettings usingEnvironment, ICreateDocumentClients factory, IProvideSafeOperations safeOperations) { It.IsNull(usingEnvironment) .AsGuard <ArgumentNullException>(nameof(usingEnvironment)); It.IsNull(factory) .AsGuard <ArgumentNullException>(nameof(factory)); It.IsNull(safeOperations) .AsGuard <ArgumentNullException>(nameof(safeOperations)); EndpointAddress = usingEnvironment.GetVariable(DocumentStoreEndpointAddressKey); It.IsEmpty(EndpointAddress) .AsGuard <ArgumentNullException>(nameof(EndpointAddress)); AccountKey = usingEnvironment.GetVariable(DocumentStoreAccountKey); It.IsEmpty(AccountKey) .AsGuard <ArgumentNullException>(nameof(AccountKey)); Client = factory.CreateClient(new Uri(EndpointAddress), AccountKey); SafeOperations = safeOperations; }