static async Task Main(string[] args) { if (args.Length == 0) { Console.WriteLine("No words were entered"); return; } DependencyInjectionConfig.SetUpApp(); var searchFightService = DependencyInjectionConfig.ServiceProvider.GetService <ISearchService>(); var searchFightResults = await searchFightService.RunProcess(args); foreach (var resultByWord in searchFightResults.ResultsByWord) { var sb = new StringBuilder(); sb.Append($"{resultByWord.Key}: "); foreach (var searchEngineResult in resultByWord.Value) { sb.Append($"{searchEngineResult.Key}: {searchEngineResult.Value} "); } Console.WriteLine(sb.ToString()); } Console.WriteLine(); foreach (var providerWinner in searchFightResults.WinnerByProvider) { Console.WriteLine($"{providerWinner.Key} Winner: {providerWinner.Value}"); } Console.WriteLine($"\nTotal Winner: {searchFightResults.ProviderWinner}"); Console.ReadLine(); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { AuthenticationConfig.Configure(services, Configuration); BlazorConfig.Configure(services, Configuration); DependencyInjectionConfig.Configure(services, Configuration); }
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { DependencyInjectionConfig.RegisterDependencies(); BundleConfig.RegisterBundles(BundleTable.Bundles); BackOfficeMappingConfig.RegisterMapping(); RouteTable.Routes.MapMvcAttributeRoutes(); }
public void ConfigureServices(IServiceCollection services) { // Swagger Config services.AddSwaggerConfiguration(); services.AddControllers(); // IoC DependencyInjectionConfig.AddDependencyInjectionConfiguration(services); // Adding MediatR for Domain Events and Notifications services.AddMediatR(typeof(Startup)); services.AddMediatR(typeof(BaseCommand)); services.AddMediatR(typeof(NovoAgendamentoCommand)); // AutoMapper Settings services.AddAutoMapperConfiguration(); // Entity Framework services.AddDbContext <AgendamentoDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("default"))); // Controllers services.AddControllers(options => { options.Filters.Add(typeof(TransactionalActionFilter)); options.Filters.Add(typeof(ModelStateValidationFilter)); }); }
static void Main(string[] args) { DependencyInjectionConfig.ConfigureServices(); var searchService = DependencyInjectionConfig.ServContainer.GetInstance <ISearchService>(); List <SearchedWord> words = new List <SearchedWord>(); if (args == null || args.Length == 0) { Console.WriteLine("No parameters were found"); CloseApp(); } else { for (int i = 0; i < args.Length; i++) { words.Add(searchService.SearchWord(args[i])); } } #region Print Results //Print results in console words.ForEach(pl => Console.WriteLine($"{pl.name}: Google: {pl.googleResults} MSN Search: {pl.bingResults}")); Console.WriteLine(); //Print winners in console Console.WriteLine($"Google Winner : {words.OrderByDescending(x => x.googleResults).FirstOrDefault().name}"); Console.WriteLine($"MSN Search winner : {words.OrderByDescending(x => x.bingResults).FirstOrDefault().name}"); Console.WriteLine($"Total Winner : {words.OrderByDescending(x => x.total).FirstOrDefault().name}"); #endregion Print Results CloseApp(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddLogging(); services.AddSignalR(); DependencyInjectionConfig.RegisterDependencies(services, Configuration); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public BaseTest() { var services = new ServiceCollection(); DependencyInjectionConfig.Configure(services); ServiceProvider = services.BuildServiceProvider(); }
public MessagesUpdateTimestampTests() { DependencyInjectionConfig.Init(); var secureStorageService = ServiceLocator.Current.GetInstance <SecureStorageService>(); secureStorageService.SetSecureStorageInstance(new SecureStorageMock()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { DependencyInjectionConfig.AddScope(services); DBContextConfig.Initialize(services); services.AddCors(); services.AddMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //services.AddDbContext<TestDBContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2).AddJsonOptions( options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore ); services.Configure <ApiBehaviorOptions>(options => { options.SuppressModelStateInvalidFilter = true; }); //services.AddDbContext<TestDBContext>(options => options.UseSqlServer(connection)); services.AddDbContext <TestDBContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"])); DependencyInjectionConfig.AddScope(services); services.AddAuthentication(GetAuthenticationOptions).AddJwtBearer(GetJwtBearerOptions); //JwtConfig.AddJwtAuthentication(services, Configuration); services.AddCors(options => { options.AddPolicy("AllowAll", p => { p.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod(); }); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddAutoMapper(typeof(Startup)); services.AddControllers().AddNewtonsoftJson(options => { options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "GoodBooks API", Version = "v1" }); }); services.AddOptions <ElasticsearchOptions>().Bind(Configuration.GetSection(ElasticsearchOptions.Section)) .ValidateDataAnnotations(); services.AddElasticsearch(Configuration); services.AddDbContext <GoodBooksContext>(options => options.UseSqlServer(Configuration.GetConnectionString("GoodBooks"))); DependencyInjectionConfig.RegisterServices(services); }
/// <summary> /// Not for public consumption! Only exposed for unit testing! /// </summary> internal ServiceProvider InitializeServiceProvider(IArguments arguments) { DependencyInjectionConfig.ConfigureServices(serviceCollection); serviceCollection.AddSingleton(arguments); return(serviceCollection.BuildServiceProvider()); }
public App() { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MTI5MTM3QDMxMzcyZTMyMmUzMEJGWnBsWGtBazdaakVueEVqOStML3JJRjJCemE2NzhXcDBualJsaFg5a2c9"); InitializeComponent(); // FFImageLoading CachedImage.FixedOnMeasureBehavior = true; CachedImage.FixedAndroidMotionEventHandler = true; DependencyInjectionConfig.Initialize(); CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) => { System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}"); //TODO: Send token to server }; CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => { System.Diagnostics.Debug.WriteLine("Received"); }; CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) => { ProductFilters.Instance.IsFromFilters = false; Application.Current.MainPage = new ProductPage(); System.Diagnostics.Debug.WriteLine("Opened"); foreach (var data in p.Data) { System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}"); } }; var connectionError = new Label { Text = "" }; MainPage = new ContentPage { Content = new StackLayout { Padding = 50, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { connectionError } } }; if (CrossConnectivity.Current.IsConnected) { MainPage = new MainPage(); } else { connectionError.Text = "Please check connection!"; } }
protected void Application_Start() { GlobalConfiguration.Configure(config => { WebApiConfig.Register(config); DependencyInjectionConfig.Register(config); }); }
public MessageUtilsTests() { DependencyInjectionConfig.Init(); var secureStorageService = ServiceLocator.Current.GetInstance <SecureStorageService>(); secureStorageService.SetSecureStorageInstance(new SecureStorageMock()); ApiStubHelper.StartServer(); }
protected void Application_Start() { DependencyInjectionConfig.RegisterDependencies(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.ConfigureMvc(); services.ConfigureVersioning(); services.ConfigureSwagger(); DependencyInjectionConfig.ConfigureContainer(services); }
public void AutoMapperConfig_ShouldBeValid() { // Arrange MapperConfiguration config = DependencyInjectionConfig.CreateAutoMapperConfig(); // Act & Assert config.AssertConfigurationIsValid(); }
public void TestInit() { kernel = DependencyInjectionConfig.CreateKernel(); IMoviesContext dbContext = kernel.Get <IMoviesContext>(); dbContext.Genres.Add(genre); dbContext.SaveChanges(); }
protected void Application_Start() { DependencyInjectionConfig.RegisterTypes(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ModelBinders.Binders.DefaultBinder = new DevExpress.Web.Mvc.DevExpressEditorsBinder(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DependencyInjectionConfig.Register(); log4net.Config.XmlConfigurator.Configure(); }
public CalculatorTests() { var builder = new ContainerBuilder(); builder.RegisterType <MockSettingsProvider>().AsImplementedInterfaces().SingleInstance(); builder.RegisterType <AppConfigBricklinkCredentialProvider>().AsImplementedInterfaces().SingleInstance(); _container = DependencyInjectionConfig.Setup(builder); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DependencyInjectionConfig.Setup(); }
protected void Application_Start() { #if DEBUG LogManager.AddDebugListener(true); #endif DependencyInjectionConfig.RegisterServiceLocatorAsDependencyResolver(); GlobalConfiguration.Configuration.DependencyResolver = new CatelWebApiDependencyResolver(); }
public static ISImplHostBuilder UseDependencyInjection(this ISImplHostBuilder host, Action <DependencyInjectionConfig> queueConfig) { var config = new DependencyInjectionConfig(); queueConfig.Invoke(config); var module = host.AttachNewOrGetConfiguredModule(() => new DependencyInjectionModule(config)); return(host); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { DependencyInjectionConfig.AddScope(services); services.AddControllers(); services.AddCors(c => { c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin()); }); }
public ColorServiceTests() { var builder = new ContainerBuilder(); builder.RegisterType <AppConfigBricklinkCredentialProvider>().AsImplementedInterfaces().SingleInstance(); var container = DependencyInjectionConfig.Setup(builder); _service = container.Resolve <IColorService>(); }
public void Setup() { var builder = new ContainerBuilder(); builder.RegisterType <AppConfigBricklinkCredentialProvider>().AsImplementedInterfaces().SingleInstance(); var container = DependencyInjectionConfig.Setup(builder); _api = container.Resolve <IBricklinkWantedListApi>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddDbContext <MyFitnessLogContext>(options => { options.UseSqlServer(Configuration["ConnectionStrings:SqlConnectionString"], actions => actions.MigrationsAssembly("MyFitnessLog.Data.Models")); }); DependencyInjectionConfig.Configure(services); }
private TestCompositionRoot(IServiceCollection services, bool useFakes) { DependencyInjectionConfig.Configure(services, new ConfigurationRoot(new List <IConfigurationProvider>())); if (useFakes) { RegisterFakes(services); } _provider = services.BuildServiceProvider(); }