public async Task <ActionResult> CreatePersonal(PersonalStorageCreateModel model) { if (!ModelState.IsValid) { return(View(model)); } var newStorage = Storage.NewStorage(model.Name, User.Identity.Name, StorageType.Personal); Mapper.Map(model, newStorage); try { BlobStorageConfig.Initialize(newStorage); } catch (SqlException exception) { ModelState.AddModelError("", exception.Message); return(View(model)); } await _storageDbCommand.CreateAsync(newStorage); return(RedirectToAction("Index")); }
public async Task CreateCommonTest() { var storage = Storage.NewStorage("CreateCommonTest", "Owner", StorageType.Common); storage.ConnectionProperties = new ConnectionProperties(@"(localdb)\v11.0", "BloqsTest_CreateCommon", "sa", "password"); storage.IsSuspended = true; storage.ThresholdLength = 20000; await _dbCommand.CreateAsync(storage); var created = await _dbCommand.FindAsync(storage.Id); created.IsStructuralEqual(storage); }
public void InitializeDatabases() { var storageDbCommand = new StorageDbCommand(Constants.ConnectionString); foreach (var storage in this) { BlobStorageConfig.Initialize(storage); TestUtilities.TruncateAllTables(storage.ConnectionProperties.ToConnectionString()); storageDbCommand.CreateAsync(storage).Wait(); } }