private static void SeedDb(PollSystemDbCotnext dbContext) { dbContext.Add(CreateWhatsYourFavoriteProgrammingLanguage()); dbContext.Add(CreateWhatsYourHomeTown()); dbContext.Add(CreateWhatsYourFavoriteBeer()); dbContext.Add(CreateWhatsYourFavoriteColor()); dbContext.SaveChanges(); }
public static PollSystemDbCotnext GetCotnextPerRequest() { HttpContext httpContext = HttpContext.Current; if (httpContext == null) { return new PollSystemDbCotnext(); } else { PollSystemDbCotnext dbContext = httpContext.Items[contextKey] as PollSystemDbCotnext; if (dbContext == null) { dbContext = new PollSystemDbCotnext(); httpContext.Items[contextKey] = dbContext; } return dbContext; } }
public UserStore() { this.dbContext = new PollSystemDbCotnext(); }
protected override void OnInit(EventArgs e) { base.OnInit(e); this.DbContext = ContextFactory.GetCotnextPerRequest(); }
public RoleStore() { this.dbCotnext = new PollSystemDbCotnext(); }
public static void Main(string[] args) { PollSystemDbCotnext dbContext = new PollSystemDbCotnext(); dbContext.CreateOrUpdateDatabase(); SeedDb(dbContext); }