protected void Application_Start() { DependencyResolverConfig.Initialize(); BundleConfig.RegisterBundles(BundleTable.Bundles); AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { // Enables and configures selected Kentico ASP.NET MVC integration features ApplicationConfig.RegisterFeatures(ApplicationBuilder.Current); // Registers routes including system routes for enabled features RouteConfig.RegisterRoutes(RouteTable.Routes); // Custom Bundles Bundles.RegisterBundles(BundleTable.Bundles); // Clear cache on application start. CacheHelper.ClearCache(); #region "AutoFac Cache and other dependency injections" // Register AutoFac Items var builder = new ContainerBuilder(); // Register Dependencies for Cache DependencyResolverConfig.Register(builder); // Register AutoMapper AutoMapper.Resolver.AutoMapperDependencyResolverConfig.Register(builder); // Set Autofac Dependency resolver to the builder DependencyResolver.SetResolver(new AutofacDependencyResolver(builder.Build())); #endregion RegisterPageTemplateFilters(); // SECURITY: Remove MVC Response powered by MvcHandler.DisableMvcResponseHeader = true; }
public static void Initialize() { DependencyResolverConfig.RegisterType(new WebTypeResolver()); DependencyResolver.SetResolver(new UnityDependencyResolver(DependencyResolverConfig.Container)); RouteConfig.RegisterRoute(new DefaultRouteResolver()); FilterConfig.RegisterFilter(new DefaultFilterResolver()); BundleConfig.RegisterBundle(new DefaultBundleResolver()); MappingConfig.RegisterMapping(new DefaultProfile()); DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; foreach (ModelValidatorProvider provider in ModelValidatorProviders.Providers) { if (provider is ClientDataTypeModelValidatorProvider) { ModelValidatorProviders.Providers.Remove(provider); break; } } ModelMetadataProviders.Current = new RPModelMetadataProvider(); ModelBinders.Binders.Add(typeof(double), new DoubleModelBinder()); ModelBinders.Binders.Add(typeof(ICollection <int>), new IntCollectionModelBinder()); ModelBinders.Binders.Add(typeof(KeyValuePair <,>), new KeyValuePairModelBinder()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); DependencyResolverConfig.RegisterDependencies(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DependencyResolverConfig.RegisterDependencies(); AutoMapperConfig.RegisterMappings(); }
public void Test() { var configureContainer = DependencyResolverConfig.ConfigureContainer(); var companyKeyPersonsRetriever = configureContainer.Resolve <ICompanyKeyPersonsRetriever>(); var keyPersons = companyKeyPersonsRetriever.GetKeyPersons("GOOGL.OQ"); Assert.IsNotNull(keyPersons); }
public void ConfigureContainer_ResolveICompanyValuationService_ResolvedInnocentCompanyValuationService() { // Act var configureContainer = DependencyResolverConfig.ConfigureContainer(); var companyValuationService = configureContainer.Resolve <ICompanyValuationService>(); // Assert companyValuationService.Should().BeOfType <CompanyValuationService>(); }
public void ConfigureContainer_ResolveCompanyController_Resolved() { // Act var configureContainer = DependencyResolverConfig.ConfigureContainer(); var valuationController = configureContainer.Resolve <CompanyController>(); // Arrange valuationController.Should().BeOfType <CompanyController>(); }
public async Task EvaluatePersonAsync_SuspiciousPerson_SomeResults() { var configureContainer = DependencyResolverConfig.ConfigureContainer(); var personEvaluationService = configureContainer.Resolve <IPersonEvaluationService>(); var searchEngineResults = await personEvaluationService.EvaluatePersonAsync("Stella Handler", "fraud"); // Assert searchEngineResults.Should().HaveCountGreaterThan(0); }
public async Task EvaluatePersonAsync_InnocentPerson_ZeroResults() { var configureContainer = DependencyResolverConfig.ConfigureContainer(); var personEvaluationService = configureContainer.Resolve <IPersonEvaluationService>(); var searchEngineResults = await personEvaluationService.EvaluatePersonAsync("Michael Corbat", "money laundering"); // Assert searchEngineResults.Should().HaveCount(0); }
public void ConfigureContainer_ResolveCashedCompanyDataRetriever_Resolved() { // Act var configureContainer = DependencyResolverConfig.ConfigureContainer(); var cashedCompanyDataRetriever1 = configureContainer.Resolve <ICashedCompanyDataRetriever>(); var cashedCompanyDataRetriever2 = configureContainer.Resolve <ICashedCompanyDataRetriever>(); // Assert cashedCompanyDataRetriever1.Should().Be(cashedCompanyDataRetriever2); }
public async Task ConfigureContainer_ResolveICompanyValuationService_ResolvedInnocentCompanyValuationService() { // Act var configureContainer = DependencyResolverConfig.ConfigureContainer(); var companyValuationService = configureContainer.Resolve <IInnocentCompanyValuationService>(); var companyValuationData = await companyValuationService.GetCompanyValuationData("citigroup"); // Assert companyValuationData.TotalScore.Should().Be(0); }
public static void Initialize() { DependencyResolverConfig.RegisterType( new WebTypeResolver() ); Mapper.Initialize(config => { config.AddProfile(new MappingProfile()); }); Mapper.AssertConfigurationIsValid(); }
protected void Application_Start() { ApplicationConfig.RegisterFeatures(ApplicationBuilder.Current); var container = DependencyResolverConfig.BuildContainer(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); WebApiConfig.ConfigureWebApi(container); RouteConfig.RegisterRoutes(RouteTable.Routes); FilterConfig.RegisterGlobalFilters(ValueProviderFactories.Factories, container); }
public RequestDispatcherTest(ITestOutputHelper testOutputHelper) { _container = DependencyResolverConfig.StartRegistrations() .CoreDependencies() .FakeDatabases() .FakeSmtpClientWrapper() .FakeApplicationSettings() .TestOutputHelper(testOutputHelper) .EventSubscriberDiagnostics() .CommandHandlerDiagnostics() .QueryHandlerDiagnostics() .SmtpClientDiagnostics() .DbContextDiagnostics() .VerifyContainer(); }
public async Task Initialize_TotalScore_IsGreaterThanZero() { // Arrange var configureContainer = DependencyResolverConfig.ConfigureContainer(); var valuationInitializer = configureContainer.Resolve <IValuationInitializer>(); var cashedValuationService = configureContainer.Resolve <ICashedValuationService>(); // Act valuationInitializer.Initialize(); var cachedValudationData = await cashedValuationService.GetCachedValudationData("bezeq"); // Assert cachedValudationData.TotalScore.Should().BeGreaterThan(0); }
protected void Application_Start() { // ADD THE BELOW TO YOUR APPLICATION_START #region "AutoFac Cache and other dependency injections" // Register AutoFac Items var builder = new ContainerBuilder(); // Register Dependencies for Cache DependencyResolverConfig.Register(builder); // Set Autofac Dependency resolver to the builder DependencyResolver.SetResolver(new AutofacDependencyResolver(builder.Build())); #endregion }
static void Main() { Bootstrapper.Initialize(); var apiCallerService = DependencyResolverConfig.Resolve <ApiCallerService>(); #if DEBUG Console.WriteLine(ServiceConfigManager.ServiceName); Console.WriteLine(">> Service is starting... Press any key for exit."); apiCallerService.DebugStart(); Console.ReadKey(); Console.WriteLine(">> Service is stopping."); apiCallerService.Stop(); #else ServiceBase.Run(apiCallerService); #endif }
//[Ignore("Integration")] public async Task EvaluateCompany(string companyName) { var configureContainer = DependencyResolverConfig.ConfigureContainer(); var companyValuationService = configureContainer.Resolve <ICompanyValuationService>(); CompanyData companyValuationData = await companyValuationService.GetCompanyValuationData(companyName); var serializer = new JsonSerializer { Formatting = Formatting.Indented }; using (var file = File.CreateText($@"c:\work\github\kyciti-api\{companyName}.json")) { serializer.Serialize(file, companyValuationData); } }
public static void MakeReports(BackgroundJobInfo jobInfo) { var resolver = DependencyResolverConfig.GetResolver(true); var service = (IReportingService)resolver.GetService(typeof(IReportingService)); var fetcher = new EndpointFetcher(); foreach (var endpoint in jobInfo.Endpoints) { Task.Run(() => { var report = fetcher.MakeHealthReport(endpoint.Url, endpoint.Id); report.IntervalInMinutes = jobInfo.FetchIntervalInMinutes; service.AddReportSyncroniously(report); }); } }
protected void Application_Start() { /** * Enables and configures selected Kentico ASP.NET MVC integration features */ ApplicationConfig.RegisterFeatures(ApplicationBuilder.Current); var container = DependencyResolverConfig.Register(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); RouteConfig.RegisterRoutes(RouteTable.Routes, container); WebApiConfig.ConfigureWebApi(container); BundleConfig.RegisterBundles(BundleTable.Bundles); FilterConfig.RegisterGlobalFilters(FilterProviders.Providers, GlobalFilters.Filters, container); }
protected void Application_Start() { var config = GlobalConfiguration.Configuration; var container = DependencyResolverConfig.GetContainer(); container.RegisterWebApiControllers(config); container.Verify(); //Check that everything is registered correctly config.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container); AutoMapperConfig.RegisterMappings(); //config.Formatters.JsonFormatter.SerializerSettings = // new JsonSerializerSettings() { Converters = new List<JsonConverter> { new ObjectIdConverter() } }; AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { // Register services both CMS and custom DependencyInjectionConfig.RegisterDependencies(); // Enables and configures selected Kentico ASP.NET MVC integration features ApplicationConfig.RegisterFeatures(ApplicationBuilder.Current); // Registers routes including system routes for enabled features RouteConfig.RegisterRoutes(RouteTable.Routes); // Custom Bundles Bundles.RegisterBundles(BundleTable.Bundles); // Clear cache on application start. CacheHelper.ClearCache(); #region "AutoFac Cache and other dependency injections" // Register AutoFac Items var builder = new ContainerBuilder(); // Register Dependencies for Cache DependencyResolverConfig.Register(builder); // Autowire Property Injection for controllers (can't have constructor injection) var allControllers = Assembly.GetExecutingAssembly().GetTypes().Where(type => typeof(BaseController).IsAssignableFrom(type)); foreach (var controller in allControllers) { builder.RegisterType(controller).PropertiesAutowired(); } // Set Autofac Dependency resolver to the builder DependencyResolver.SetResolver(new AutofacDependencyResolver(builder.Build())); #endregion RegisterPageTemplateFilters(); }
public static void Initialize() { DependencyResolverConfig.RegisterType( new ApiCallerTypeResolver() ); }
// MVC Caching public void ConfigureContainer(ContainerBuilder builder) { DependencyResolverConfig.Register(builder, new Assembly[] { typeof(Startup).Assembly }); }