コード例 #1
0
        public async Task <ICosmosDbContainer> CreateContainer(ContainerDefinition containerDefinition)
        {
            return(await _containerCache.GetOrAddAsync(containerDefinition.ContainerId, async id =>
            {
                //ContainerDefinition definition = GetContainerDefinitionForType(containerDefinition.EntityType);
                ContainerDefinition definition = GetContainerDefinition(containerDefinition.ContainerId);

                // Container cosmosSdkContainer = await Internal_GetContainer(containerDefinition.ContainerId);
                Container cosmosSdkContainer = await Internal_EnsureContainerExists(await this.GetDatabase(), containerDefinition);

                var container = new CosmosDbContainer(definition, this, cosmosSdkContainer);

                return _containerFactory == null ? container : _containerFactory.Create(container);
            }));
        }
コード例 #2
0
        public async Task <ICosmosDbContainer> CreateContainer(ContainerDefinition containerDefinition)
        {
            return(await _containerCache.GetOrAddAsync(containerDefinition.ContainerId, async id =>
            {
                Container cosmosSdkContainer = await Internal_GetContainer(containerDefinition.ContainerId);
                ContainerDefinition definition = GetContainerDefinition(containerDefinition.ContainerId);
                var container = new CosmosDbContainer(definition, this, cosmosSdkContainer);

                if (_containerFactory != null)
                {
                    return _containerFactory.Create(container);
                }
                else
                {
                    return container;
                }
            }));
        }