public SimpleMembershipInitializer()
            {
                Database.SetInitializer <DropItContext>(null);
                try
                {
                    using (var context = new DropItContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Create the SimpleMembership database without Entity Framework migration schema
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                        }
                    }

                    if (!WebSecurity.Initialized)
                    {
                        WebSecurity.InitializeDatabaseConnection("DropItContext_User", "User", "UserId", "UserName", autoCreateTables: true);
                    }

                    if (!Roles.RoleExists("Administrator"))
                    {
                        Roles.CreateRole("Administrator");
                    }

                    if (!WebSecurity.UserExists("admin"))
                    {
                        WebSecurity.CreateUserAndAccount(
                            "admin",
                            "password", new { Email = "*****@*****.**", Phone = "0909777777", Address = "123 To Ky", ProvinceId = "1", Sellable = false, Active = false, CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now }, false);
                    }

                    if (!Roles.GetRolesForUser("admin").Contains("Administrator"))
                    {
                        Roles.AddUsersToRoles(new[] { "admin" }, new[] { "Administrator" });
                    }
                }
                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);
                }
            }
 public VenueRepository(DropItContext context)
     : base(context)
 {
 }
 public UserRepository(DropItContext context) : base(context)
 {
 }
Beispiel #4
0
 public FollowEventRepository(DropItContext context)
     : base(context)
 {
 }
Beispiel #5
0
 public SettingRepository(DropItContext context) : base(context)
 {
 }
 public CategoryRepository(DropItContext context)
     : base(context)
 {
 }
 public RequestRepository(DropItContext context)
     : base(context)
 {
 }
 public GenericRepository(DropItContext ctx)
 {
     this.context = ctx;
     this.dbSet   = ctx.Set <TEntity>();
 }
 public NotificationRepository(DropItContext context)
     : base(context)
 {
 }
 public TransactionRepository(DropItContext context)
     : base(context)
 {
 }
Beispiel #11
0
 public TicketRepository(DropItContext context)
     : base(context)
 {
 }