コード例 #1
0
ファイル: Program.cs プロジェクト: BPalagachev/PollSystem
        private static void SeedDb(PollSystemDbCotnext dbContext)
        {
            dbContext.Add(CreateWhatsYourFavoriteProgrammingLanguage());
            dbContext.Add(CreateWhatsYourHomeTown());
            dbContext.Add(CreateWhatsYourFavoriteBeer());
            dbContext.Add(CreateWhatsYourFavoriteColor());

            dbContext.SaveChanges();
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
ファイル: UserStore.cs プロジェクト: BPalagachev/PollSystem
 public UserStore()
 {
     this.dbContext = new PollSystemDbCotnext();
 }
コード例 #4
0
ファイル: BasePage.cs プロジェクト: BPalagachev/PollSystem
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     this.DbContext = ContextFactory.GetCotnextPerRequest();
 }
コード例 #5
0
 public RoleStore()
 {
     this.dbCotnext = new PollSystemDbCotnext();
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: BPalagachev/PollSystem
 public static void Main(string[] args)
 {
     PollSystemDbCotnext dbContext = new PollSystemDbCotnext();
     dbContext.CreateOrUpdateDatabase();
     SeedDb(dbContext);
 }