public async Task <ODMWorkspace> GetWorkspaceAsync(string ownerId, bool retrieveCached) { if (retrieveCached) { return(activeWorkspace); } else { List <ODMWorkspace> workspaceLockup = await workspaceRepo.GetItemsAsync(x => x.OwnerId == ownerId) as List <ODMWorkspace>; //No workspace found for OwnerId if (workspaceLockup.Count == 0) { throw new InvalidOperationException("Owner workspace do not exist"); } else { //TODO: Add logic to handle multiple workspaces for same owner. for now only a single workspace for owner is supported. activeWorkspace = workspaceLockup[0]; } filesBlobContainer = new AzureBlobStorageRepository(blobStorageName, blobStorageKey, activeWorkspace.FilesCotainerUri); modelsBlobContainer = new AzureBlobStorageRepository(blobStorageName, blobStorageKey, activeWorkspace.ModelCotainerUri); return(activeWorkspace); } }
public AzureBlobRepositorySpecSetup() { var config = new ConfigurationBuilder().AddJsonFile(@"appsettings.json").Build(); var settings = new NetCoreAppSettings(config); Blobository = AzureBlobStorageRepository.FromSettings(settings); AzureStorageAccountBase.InitializeAllTests(); }
private async Task <ODMWorkspace> GetOrCreateWorkspaceAsync(string ownerId) { List <ODMWorkspace> workspaceLockup = await workspaceRepo.GetItemsAsync(x => x.OwnerId == ownerId) as List <ODMWorkspace>; //No workspace found for OwnerId if (workspaceLockup.Count == 0) { activeWorkspace = await CreateWorkspaceAsync(ownerId, new ModelPolicy()); } else { //TODO: Add logic to handle multiple workspaces for same owner. for now only a single workspace for owner is supported. activeWorkspace = workspaceLockup[0]; } filesBlobContainer = new AzureBlobStorageRepository(blobStorageName, blobStorageKey, activeWorkspace.FilesCotainerUri); modelsBlobContainer = new AzureBlobStorageRepository(blobStorageName, blobStorageKey, activeWorkspace.ModelCotainerUri); return(activeWorkspace); }
public VisitorIdentificationManager(string cognitiveKey, string cognitiveEndpoint, string faceFilter, string cosmosDbEndpoint, string cosmosDbKey, string cosmosDbName, string storageConnection, string storageContainerName) { key = cognitiveKey; endpoint = cognitiveEndpoint; faceWorkspaceDataFilter = faceFilter; FaceServiceHelper.ApiKey = key; FaceServiceHelper.ApiEndpoint = endpoint; FaceListManager.FaceListsUserDataFilter = faceWorkspaceDataFilter; var dbClient = new DocumentClient( new Uri(cosmosDbEndpoint), cosmosDbKey, new ConnectionPolicy { EnableEndpointDiscovery = false }); var dbFactory = new CosmosDbClientFactory( cosmosDbName, new Dictionary <string, string> { { AppConstants.DbColIdentifiedVisitor, AppConstants.DbColIdentifiedVisitorPartitionKey }, { AppConstants.DbColIdentifiedVisitorGroup, AppConstants.DbColIdentifiedVisitorPartitionKey } }, dbClient); identifiedVisitorRepo = new IdentifiedVisitorRepo(dbFactory); identifiedVisitorGroupRepo = new IdentifiedVisitorGroupRepo(dbFactory); storageRepo = new AzureBlobStorageRepository(storageConnection, storageContainerName); //serviceBusRepo = new AzureServiceBusRepository(serviceBusConnection, AppConstants.SBTopic, AppConstants.SBSubscription); }