Ejemplo n.º 1
0
        /// <summary>
        /// Connects the database.
        /// </summary>
        private void ConnectDB()
        {
            Logger.Debug("ConnectDB...");

            try
            {
                // Add this code line to fix following bug:
                // System.InvalidOperationException: The model backing the 'DBEntities'
                // context has changed since the database was created.
                // Consider using Code First Migrations to update the database
                // (http://go.microsoft.com/fwlink/?LinkId=238269).
                Database.SetInitializer <RFODbContext>(null);
                SimpleMembershipInitializer <RFODbContext> .Initialize();

                SimpleMembershipInitializer <RFODbContext> .CreateRoles(
                    new string[]
                {
                    AppConstants.AdminRole,
                    AppConstants.EmployeeRole,
                    AppConstants.UserRole,
                });
            }
            catch (Exception ex)
            {
                throw new DatabaseException(ex.ToString());
            }

            Logger.Debug("ConnectDB...DONE");
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            SimpleMembershipInitializer.Initialize();
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            Bootstrapper.Initialize();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Applications the start.
        /// </summary>
        protected void Application_Start()
        {
            var funcName = "Application_Start";

            Logger.DebugFormat("{0} <-- Start", funcName);

            GlobalConfiguration.Configure(WebApiConfig.Register);

            // Add this code line to fix following bug:
            // System.InvalidOperationException: The model backing the 'DBEntities'
            // context has changed since the database was created.
            // Consider using Code First Migrations to update the database
            // (http://go.microsoft.com/fwlink/?LinkId=238269).
            Database.SetInitializer <RFODbContext>(null);
            SimpleMembershipInitializer <RFODbContext> .Initialize();

            // Create compositions for using MEF
            var bootstrapper = new BootStrapper();

            bootstrapper.CreateComposition();

            Logger.DebugFormat("{0} --> End", funcName);
        }