Esempio n. 1
0
        protected ChildEntityDataStore(
            string tableName,
            EntityDataStoreOptions entityDataStoreOptions)
        {
            if (string.IsNullOrWhiteSpace(tableName))
            {
                throw new ArgumentNullException(nameof(tableName));
            }

            if (entityDataStoreOptions == null)
            {
                throw new ArgumentNullException(nameof(entityDataStoreOptions));
            }

            _primaryCloudTable =
                entityDataStoreOptions.PrimaryCloudTableClient.GetTableReference(tableName);

            _primaryCloudTable.CreateIfNotExists();

            if (entityDataStoreOptions.SecondaryCloudTableClient != null)
            {
                _secondaryCloudTable =
                    entityDataStoreOptions.SecondaryCloudTableClient.GetTableReference(tableName);

                _secondaryCloudTable.CreateIfNotExists();
            }
        }
Esempio n. 2
0
        protected EntityDataStore(
            string tableName,
            EntityDataStoreOptions entityDataStoreOptions)
        {
            if (string.IsNullOrWhiteSpace(tableName))
            {
                throw new ArgumentNullException(nameof(tableName));
            }

            if (entityDataStoreOptions == null)
            {
                throw new ArgumentNullException(nameof(entityDataStoreOptions));
            }

            if (entityDataStoreOptions.CosmosClient == null)
            {
                throw new ArgumentNullException(nameof(entityDataStoreOptions.CosmosClient));
            }

            if (entityDataStoreOptions.DatabaseId == null)
            {
                throw new ArgumentNullException(nameof(entityDataStoreOptions.DatabaseId));
            }

            _cosmosClient =
                entityDataStoreOptions.CosmosClient;

            var cosmosDatabase =
                _cosmosClient.GetDatabase(
                    entityDataStoreOptions.DatabaseId);

            _cosmosContainer =
                cosmosDatabase.GetContainer(
                    tableName);
        }