Beispiel #1
0
        protected override void OnApplicationStarted()
        {
            AreaRegistration.RegisterAllAreas();

            MVCControlsToolkit.Core.Extensions.Register();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            Database.SetInitializer <RemontContext>(new InitDb());
            using (RemontContext context = new RemontContext())
            {
                context.Database.Initialize(true);
            }

            AuthConfig.RegisterAuth();

            var stringProvider = new ResourceStringProvider(Resources.Resource.ResourceManager);

            ModelMetadataProviders.Current = new LocalizedModelMetadataProvider(stringProvider);
            ModelValidatorProviders.Providers.Clear();
            ModelValidatorProviders.Providers.Add(new LocalizedModelValidatorProvider());
        }
Beispiel #2
0
 public SimpleMembershipInitializer()
 {
     try
     {
         using (RemontContext context = new RemontContext())
         {
             WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserProfileId", "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);
     }
 }