/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual bool EnsureCreated() { var model = _designTimeModel.Model; var created = _cosmosClient.CreateDatabaseIfNotExists(model.GetThroughput()); foreach (var container in GetContainersToCreate(model)) { created |= _cosmosClient.CreateContainerIfNotExists(container); } if (created) { Seed(); } return(created); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual bool EnsureCreated() { var created = _cosmosClient.CreateDatabaseIfNotExists(); foreach (var entityType in _model.GetEntityTypes()) { var containerName = entityType.GetContainer(); if (containerName != null) { created |= _cosmosClient.CreateContainerIfNotExists( containerName, GetPartitionKeyStoreName(entityType)); } } if (created) { Seed(); } return(created); }