public SimpleMembershipInitializer()
            {
                Database.SetInitializer<PiiContext>(null);

                try
                {
                    using (var context = new PiiContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Create the SimpleMembership database without Entity Framework migration schema
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                        }
                    }

                    WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                }
            }
Ejemplo n.º 2
0
 public UserRepository(PiiContext _dbContext, HttpContextBase _httpContextBase)
 {
     this.DbContext = _dbContext;
     this.HttpContext = _httpContextBase;
 }
Ejemplo n.º 3
0
 public LayoutModel(PiiContext _DbContext, HttpContextBase _HttpContext)
 {
     this.Db = _DbContext;
     this.context = _HttpContext;
 }