예제 #1
0
        public virtual async Task <bool> Init()
        {
            var endPoint = (await _configStore.GetAsync(StorageConstants.DocumentEndpoint).ConfigureAwait(false));
            var key      = (await _configStore.GetAsync(StorageConstants.DocumentKey).ConfigureAwait(false));

            _documentClient = new DocumentClient(new Uri(endPoint), key);

            await _documentClient.CreateDatabaseIfNotExistsAsync(this.Database).ConfigureAwait(false);

            await _documentClient.CreateCollectionIfNotExistsAsync(this.Database, this.Collection).ConfigureAwait(false);

            _initialized = true;
            return(_initialized);
        }
예제 #2
0
        public async Task GetTest()
        {
            ConfigurationStore configurationStore = await ConfigStore.GetAsync();

            Assert.IsTrue(ConfigurationStoreName.Equals(configurationStore.Data.Name));
            Assert.IsTrue(configurationStore.Data.PublicNetworkAccess == PublicNetworkAccess.Disabled);
        }
예제 #3
0
        CreateTableRepository(
            Type repoType,
            Tenant tenant,
            ConfigStore configStore,
            ILoggerFactory logFactory)
        {
            Ensure.ArgumentNotNull(tenant, nameof(tenant));
            Ensure.ArgumentNotNull(logFactory, nameof(logFactory));

            var credentials = new StorageCredentials(
                (await configStore.GetAsync(StorageConstants.TableAccountName).ConfigureAwait(false)),
                (await configStore.GetAsync(StorageConstants.TableAccountKey).ConfigureAwait(false)));

            var repository = (IRepository)Activator.CreateInstance(repoType, credentials, logFactory);

            if (!(await repository.Init().ConfigureAwait(false)))
            {
                // throw exception here?
            }
            return(repository);
        }