2019-03-05 13:42:07 +08:00
|
|
|
|
using System.Data.Entity;
|
2019-03-01 14:04:51 +08:00
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using System.Web.Optimization;
|
|
|
|
|
using System.Web.Routing;
|
2019-03-27 14:46:35 +08:00
|
|
|
|
using Autofac.Integration.Mvc;
|
2019-03-05 13:42:07 +08:00
|
|
|
|
using Cmdjy.Dal;
|
2019-03-01 14:04:51 +08:00
|
|
|
|
|
|
|
|
|
namespace Cmdjy
|
|
|
|
|
{
|
|
|
|
|
public class MvcApplication:System.Web.HttpApplication
|
|
|
|
|
{
|
|
|
|
|
protected void Application_Start() {
|
2019-03-27 14:46:35 +08:00
|
|
|
|
|
|
|
|
|
DependencyResolver.SetResolver(new AutofacDependencyResolver(IOC.Factory));
|
|
|
|
|
|
2019-03-26 13:49:38 +08:00
|
|
|
|
if(WebSettings.AutoMigrations) {
|
|
|
|
|
Database.SetInitializer(new MigrateDatabaseToLatestVersion<DjyDbContext,Configuration>());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Database.SetInitializer<DjyDbContext>(null);
|
|
|
|
|
}
|
2019-03-05 13:42:07 +08:00
|
|
|
|
|
2019-03-01 14:04:51 +08:00
|
|
|
|
AreaRegistration.RegisterAllAreas();
|
|
|
|
|
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
|
|
|
|
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
|
|
|
|
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|