示例#1
0
文件: Startup.cs 项目: AK33M/LunarSFX
        public void Configuration(IAppBuilder app)
        {
            var container = SimpleInjectorInitializer.Initialize(app);

            ConfigureAuth(app, container);
            ConfigureCustomModelBinder(container);
        }
示例#2
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     SimpleInjectorInitializer.Initialize();
 }
示例#3
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     SimpleInjectorInitializer.Initialize();
     //Application.Run(new Views.FormLotacao());
     Application.Run(SimpleInjectorInitializer.Container.GetInstance <Views.FormLotacao>());
 }
示例#4
0
        public void SimpleInjectorDependencyResolver_Splat_Initialization_ShouldNotThrow()
        {
            Container container = new Container();
            SimpleInjectorInitializer initializer = new SimpleInjectorInitializer();

            Locator.SetLocator(initializer);
            Locator.CurrentMutable.InitializeSplat();
            container.UseSimpleInjectorDependencyResolver(initializer);
        }
示例#5
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            SimpleInjectorInitializer.Initialize();
        }
示例#6
0
        private static void Initialize()
        {
            _container   = SimpleInjectorInitializer.CreateContainer();
            _initialized = true;

            RegisterServices(_container);

            GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(_container);
        }
示例#7
0
 protected void Application_Start()
 {
     ViewEngines.Engines.Add(new CustomRazorViewEngine());
     SimpleInjectorInitializer.Initialize();
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
示例#8
0
        static void Main(string[] args)
        {
            SimpleInjectorInitializer.Initialize();
            var customer = AddCustomer();

            Console.WriteLine("SimpleInjector Testing completed");
            Console.WriteLine(string.Format("Customer Status is: {0}", customer.Status));
            Console.ReadLine();
        }
示例#9
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            Database.SetInitializer <Context>(null);

            SimpleInjectorInitializer.Initialize();
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutoMapperConfig.RegisterMappings();
            SimpleInjectorInitializer.Initialize();

            BundleTable.EnableOptimizations = true;
        }
示例#11
0
        public void Configuration(IAppBuilder app)
        {
            var container = SimpleInjectorInitializer.Initialize(app);

            ConfigureAuth(app, container);

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
        }
示例#12
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            SimpleInjectorInitializer.Initialize();

            //AutoMapperWebProfile.Run();
        }
示例#13
0
        protected void Application_Start()
        {
            var container = new UnityContainer();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutoMapperConfig.RegisterMappings();
            SimpleInjectorInitializer.Initialize();
        }
示例#14
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //Register the implementation class and DI
            SimpleInjectorInitializer.Initialize();

            AutoMapperServiceConfiguration.Configure();
        }
示例#15
0
        protected static Container InitializeDIContainer()
        {
            var container = new Container();

            // Register dependencies.
            SimpleInjectorInitializer.InitializeContainer(container, Lifestyle.Singleton);

            // Verify registrations.
            container.Verify();

            return(container);
        }
示例#16
0
        public void Configuration(IAppBuilder app)
        {
            var container = SimpleInjectorInitializer.Initialize();

            app.Use(async(context, next) =>
            {
                using (var scope = container.BeginExecutionContextScope())
                {
                    await next.Invoke();
                }
            });
        }
示例#17
0
        public void Configuration(IAppBuilder app)
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            SimpleInjectorInitializer.Initialize();
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            // trigger db initialization
            var context  = new ContosoUniversityContext();
            var students = context.Students.ToList();
        }
示例#18
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     SimpleInjectorInitializer.Initialize();
     AutoMapperConfig.RegisterMappings();
     ModelBinders.Binders.Add(
         typeof(decimal), new DecimalModelBinder());
     ModelBinders.Binders.Add(
         typeof(decimal?), new DecimalModelBinder());
 }
示例#19
0
        public static void Main(string[] args)
        {
            // SimpleInjector container.
            _container = new Container();

            // Register dependencies.
            SimpleInjectorInitializer.InitializeContainer(_container, Lifestyle.Singleton);
            _adminManager   = _container.GetInstance <IAdminManager>();
            _companyManager = _container.GetInstance <ICompanyManager>();

            // Update company stats for modified companies.
            UpdateCompanyStats();
        }
示例#20
0
        public static void Main(string[] args)
        {
            // SimpleInjector container.
            _container = new Container();

            // Register dependencies.
            SimpleInjectorInitializer.InitializeContainer(_container, Lifestyle.Singleton);
            _adminManager        = _container.GetInstance <IAdminManager>();
            _genericEmailManager = _container.GetInstance <IGenericEmailManager>();

            // Send confirmation email reminders.
            SendFeedbackEmail();
        }
示例#21
0
        public void SimpleInjectorDependencyResolver_ShouldResolveSplatRegisteredDependency()
        {
            Container container = new Container();
            SimpleInjectorInitializer initializer = new SimpleInjectorInitializer();

            Locator.SetLocator(initializer);
            Locator.CurrentMutable.InitializeSplat();
            container.UseSimpleInjectorDependencyResolver(initializer);

            ILogger dependency = Locator.Current.GetService(typeof(ILogger)) as ILogger;

            Assert.NotNull(dependency);
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //Inicializa a injeção de dependência
            SimpleInjectorInitializer.Initialize();

            // Configurando o AutoMapper para registrar os profiles
            // de mapeamento durante a inicialização da aplicação.
            AutoMapperConfig.RegisterMappings();
        }
示例#23
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            SimpleInjectorInitializer.Initialize();

            IDataBaseCreatorRest creator = DependencyResolver.Current.GetService <IDataBaseCreatorRest>();

            creator.Create();
            AutoMapperConfiguration.Configure();
            //GlobalFilters.Filters.Add(new ProfilingActionFilter());
        }
        protected virtual HttpConfiguration CreateConfiguration()
        {
            var config = new HttpConfiguration {
                IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always
            };

            SimpleInjectorInitializer.RegisterIFilterProvider(config.Services, IoC.GetInstance <Container>());

            WebApiConfig.Register(config);

            config.DependencyResolver = GlobalConfiguration.Configuration.DependencyResolver;

            return(config);
        }
示例#25
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            var container = SimpleInjectorInitializer.Initialize();

            config.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);
            config.MapHttpAttributeRoutes();
            config.EnableCors();
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
示例#26
0
        public static void Main(string[] args)
        {
            // SimpleInjector container.
            _container = new Container();

            // Register dependencies.
            SimpleInjectorInitializer.InitializeContainer(_container, Lifestyle.Singleton);

            _userStore                = new AppUserStore <AppUser>(new IdentityDatabaseContext <AppUser, IdentityRole>());
            _userManager              = new UserManager <AppUser, int>(_userStore);
            _adminManager             = _container.GetInstance <IAdminManager>();
            _userManager.EmailService = new EmailService();

            // Send confirmation email reminders.
            SendConfirmationEmailReminders().Wait();
        }
示例#27
0
        protected void Application_Start()
        {
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();

            SimpleInjectorInitializer.InitializeContainer(container);//packages from Injection folder

            container.RegisterWebApiControllers(GlobalConfiguration.Configuration);

            container.Verify();

            GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);

            GlobalConfiguration.Configure(WebApiConfig.Register);
        }
示例#28
0
        public void Configuration(IAppBuilder app)
        {
            // Realiza as configurações gerais da API
            GlobalConfiguration.Configure(WebApiConfig.Register);
            SimpleInjectorInitializer.Initialize();
            AutoMapperInitializer.Initialize();
            // Cria a configuração da api
            HttpConfiguration config = new HttpConfiguration();

            // Configura a autenticação
            OAuthConfig.ConfigureOAuth(app);

            config.MessageHandlers.Add(new CustomLogHandler());

            // Inicia a API com as configurações
            app.UseWebApi(config);
        }
示例#29
0
        protected void Application_Start()
        {
            var config = GlobalConfiguration.Configuration;

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutoMapperConfig.RegisterMappings();
            SimpleInjectorInitializer.Initialize();

            Hangfire.HangfireAspNet.Use(HangfireInitializer.GetHangfireServers);
            StartService();

            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
        }
        /// <summary>Initialize the container and register it as MVC3 Dependency Resolver.</summary>
        public static void Initialize()
        {
            // Did you know the container can diagnose your configuration?
            // Go to: https://simpleinjector.org/diagnostics
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new WebRequestLifestyle();

            // Register dependencies.
            SimpleInjectorInitializer.InitializeContainer(container, Lifestyle.Scoped);
            container.RegisterMvcControllers(Assembly.GetExecutingAssembly());

            // Verify registrations.
            container.Verify();

            DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
        }