public void Configuration(IAppBuilder app) { var container = SimpleInjectorInitializer.Initialize(app); ConfigureAuth(app, container); ConfigureCustomModelBinder(container); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); SimpleInjectorInitializer.Initialize(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SimpleInjectorInitializer.Initialize(); //Application.Run(new Views.FormLotacao()); Application.Run(SimpleInjectorInitializer.Container.GetInstance <Views.FormLotacao>()); }
public void SimpleInjectorDependencyResolver_Splat_Initialization_ShouldNotThrow() { Container container = new Container(); SimpleInjectorInitializer initializer = new SimpleInjectorInitializer(); Locator.SetLocator(initializer); Locator.CurrentMutable.InitializeSplat(); container.UseSimpleInjectorDependencyResolver(initializer); }
protected void Application_Start() { GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); SimpleInjectorInitializer.Initialize(); }
private static void Initialize() { _container = SimpleInjectorInitializer.CreateContainer(); _initialized = true; RegisterServices(_container); GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(_container); }
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); }
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(); }
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; }
public void Configuration(IAppBuilder app) { var container = SimpleInjectorInitializer.Initialize(app); ConfigureAuth(app, container); JsonConvert.DefaultSettings = () => new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; }
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(); }
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(); }
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(); }
protected static Container InitializeDIContainer() { var container = new Container(); // Register dependencies. SimpleInjectorInitializer.InitializeContainer(container, Lifestyle.Singleton); // Verify registrations. container.Verify(); return(container); }
public void Configuration(IAppBuilder app) { var container = SimpleInjectorInitializer.Initialize(); app.Use(async(context, next) => { using (var scope = container.BeginExecutionContextScope()) { await next.Invoke(); } }); }
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(); }
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()); }
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(); }
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(); }
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(); }
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); }
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 } ); }
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(); }
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); }
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); }
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)); }