protected void Application_Start()
        {
            try
            {
                /*
                 * Initialize Database
                 */
                Fluently.Configure()
                    .Database(MsSqlConfiguration.MsSql2008)
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<IEntity>())
                    .ExposeConfiguration(cfg => new SchemaUpdate(cfg).Execute(false, true))
                    .BuildSessionFactory();

                var container = new ContainerFactory().CreateContainer(typeof(WebApplication).Assembly);
                DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

                AreaRegistration.RegisterAllAreas();
                RegisterGlobalFilters(GlobalFilters.Filters);
                RegisterRoutes(RouteTable.Routes);
                InitializeRoles();
                Log.Info("Site started...");
            }
            catch (Exception ex)
            {
                Log.Fatal("Failed to start site.", ex);
                throw;
            }
        }
        protected void Application_Start()
        {
            try
            {
                var container = new ContainerFactory().CreateContainer(typeof(WebApplication).Assembly);
                DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

                AreaRegistration.RegisterAllAreas();
                RegisterGlobalFilters(GlobalFilters.Filters);
                RegisterRoutes(RouteTable.Routes);

                Log.Info("Site started...");
            }
            catch (Exception ex)
            {
                Log.Fatal("Failed to start site.", ex);
                throw;
            }
        }