protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); var engineProvider = new NHibernateSharedEngineProvider(); engineProvider.GetEngine().Configure(); NHibernate.Validator.Cfg.Environment.SharedEngineProvider = engineProvider; }