public AzureStorageTests() { _cloudClient = CloudStorageAccount.Parse(ConnectionString).CreateCloudTableClient(); _table = _cloudClient.GetTableReference("Test"); _table.DeleteIfExistsAsync().Wait(); _table.CreateIfNotExistsAsync().Wait(); _context = new TableStorageContext(ConnectionString); }
public TableStorageUnitOfWork(IUnitOfWorkProvider provider, Func <ITableStorageContext> contextFactory, StorageContextOptions options) { if (options == StorageContextOptions.ReuseParentContext) { var parentUow = provider.GetCurrent() as TableStorageUnitOfWork; if (parentUow != null) { Context = parentUow.Context; return; } } Context = contextFactory(); hasOwnContext = true; }
private static Card GetCard(int userId, int cardId, ITableStorageContext tableStorageContext) { var card = tableStorageContext.Cards.GetById(userId, cardId); if (card == null) { // I'm not convinced that 422 (Unprocessable Entity) is the correct status code to return here since it's not a standard code throw new HttpResponseException(new HttpResponseMessage((HttpStatusCode)422)); } return card; }
public TokenStorageService(ITableStorageContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public ProjectStorageService(ITableStorageContext context, IMapper mapper) { _context = context; _mapper = mapper; }
private static void SetQuizResultValues(ITableStorageContext context) { var items = context.QuizResults.GetAll(); foreach (var item in items) { context.QuizResults.Update(item); } }
private static void SetConfigValues(ITableStorageContext context) { var items = context.UserConfigurations.GetAll(); foreach (var item in items) { item.QuizInterval0 = 1; item.QuizInterval1 = 5; item.QuizInterval2 = 14; item.QuizInterval3 = 28; item.QuizInterval4 = 60; item.QuizInterval5 = 120; context.UserConfigurations.Update(item); } }
private static void SetCardValues(ITableStorageContext context) { var cards = context.Cards.GetAll(); foreach (var item in cards) { context.Cards.Update(item); } }
private static void SetCardDecks(ITableStorageContext context) { var items = context.Cards.GetAll(); foreach (var item in items) { context.CardDecks.AddCardToCardDeck(item); } }
public TableStorageRepositoryBase(ITableStorageContext tableStorageContext) { this.TableStorageContext = tableStorageContext; this.userId = new Lazy<int>(() => this.TableStorageContext.UserConfigurations.GetByNameIdentifier().UserId); }