Exemplo n.º 1
0
        protected void Application_Start()
        {
            

            Action<User> saveUserToSession = (account) =>
            {
                HttpContext.Current.Session.Remove("User");
                HttpContext.Current.Session.Add("User", account);
            };
            Func<User> getFromSession = () => (User)HttpContext.Current.Session["User"];

            var memoryDataSourceUser = new Dictionary<string, User>();

            //sample initialization
            memoryDataSourceUser.Add("wow", new User() { Id = Guid.Parse("537c8609-ddbe-434f-9e74-b2f55b9a35da"),  Name = "wow", Password = "******" });
            memoryDataSourceUser.Add("wah", new User() { Id = Guid.Parse("2939c3e6-0ee6-4167-a8aa-f5e95e58edee"),  Name = "wah", Password = "******" }); 
            

            //var repoAccount = new MemoryRepoAccount(new Dictionary<Guid, Account>());
            var repoAccount = new FileSystemRepoAccount();
            var serviceAccount = new ServiceAccount(repoAccount);

            var repoUser = new MemoryRepoUser(memoryDataSourceUser);
            var serviceUser = new ServiceUser(repoUser, saveUserToSession, getFromSession);

            var filterConfig = new FilterConfig(serviceUser);

            var controllerFactory = new PoorManControllerFactory(serviceUser,serviceAccount);
            ControllerBuilder.Current.SetControllerFactory(controllerFactory);

            AreaRegistration.RegisterAllAreas();
            filterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Exemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

			GlobalConfiguration.Configure(WebApiConfig.Register);

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

            // Remove data annotations validation provider 
            ModelValidatorProviders.Providers.Remove(
                ModelValidatorProviders.Providers.OfType<DataAnnotationsModelValidatorProvider>().First());

			DependencyInjection();

		}
Exemplo n.º 3
0
        protected void Application_Start()
        {
            GlobalConfig.SetRoot(HostingEnvironment.MapPath("~/Configs/"));

            var environment = ConfigurationManager.AppSettings["Environment"];

            if (string.IsNullOrWhiteSpace(environment))
            {
                GlobalConfig.SetEnvironment("Local");
            }
            else
            {
                GlobalConfig.SetEnvironment(environment);
            }

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Exemplo n.º 4
0
        private void Application_Start()
        {
            MvcHandler.DisableMvcResponseHeader = true;

            AreaRegistration.RegisterAllAreas();

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

            var container = BuildContainer();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new FunnelWebViewEngine());

            ControllerBuilder.Current.SetControllerFactory(new FunnelWebControllerFactory(container));

            var federatedAuthenticationConfigurator = container.Resolve <IFederatedAuthenticationConfigurator>();

            federatedAuthenticationConfigurator.InitiateFederatedAuthentication();
        }
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
 }