コード例 #1
0
        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();
        }
コード例 #2
0
        // 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);
        }
コード例 #3
0
 public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     DependencyInjectionConfig.RegisterDependencies();
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     BackOfficeMappingConfig.RegisterMapping();
     RouteTable.Routes.MapMvcAttributeRoutes();
 }
コード例 #4
0
        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));
            });
        }
コード例 #5
0
        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();
        }
コード例 #6
0
 // 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);
 }
コード例 #7
0
        public BaseTest()
        {
            var services = new ServiceCollection();

            DependencyInjectionConfig.Configure(services);
            ServiceProvider = services.BuildServiceProvider();
        }
コード例 #8
0
        public MessagesUpdateTimestampTests()
        {
            DependencyInjectionConfig.Init();
            var secureStorageService = ServiceLocator.Current.GetInstance <SecureStorageService>();

            secureStorageService.SetSecureStorageInstance(new SecureStorageMock());
        }
コード例 #9
0
 // 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();
 }
コード例 #10
0
ファイル: Startup.cs プロジェクト: ciaran92/BloggerApp
        // 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();
                });
            });
        }
コード例 #11
0
ファイル: Startup.cs プロジェクト: igorslobodyanyuk/GoodBooks
        // 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);
        }
コード例 #12
0
        /// <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());
        }
コード例 #13
0
        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!";
            }
        }
コード例 #14
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(config =>
     {
         WebApiConfig.Register(config);
         DependencyInjectionConfig.Register(config);
     });
 }
コード例 #15
0
        public MessageUtilsTests()
        {
            DependencyInjectionConfig.Init();
            var secureStorageService = ServiceLocator.Current.GetInstance <SecureStorageService>();

            secureStorageService.SetSecureStorageInstance(new SecureStorageMock());
            ApiStubHelper.StartServer();
        }
コード例 #16
0
 protected void Application_Start()
 {
     DependencyInjectionConfig.RegisterDependencies();
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
コード例 #17
0
ファイル: Startup.cs プロジェクト: tassan/tassan.me
 // 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);
 }
コード例 #18
0
        public void AutoMapperConfig_ShouldBeValid()
        {
            // Arrange
            MapperConfiguration config = DependencyInjectionConfig.CreateAutoMapperConfig();

            // Act & Assert
            config.AssertConfigurationIsValid();
        }
コード例 #19
0
        public void TestInit()
        {
            kernel = DependencyInjectionConfig.CreateKernel();
            IMoviesContext dbContext = kernel.Get <IMoviesContext>();

            dbContext.Genres.Add(genre);
            dbContext.SaveChanges();
        }
コード例 #20
0
ファイル: Global.asax.cs プロジェクト: estimpson/Empire
 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();
 }
コード例 #21
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     DependencyInjectionConfig.Register();
     log4net.Config.XmlConfigurator.Configure();
 }
コード例 #22
0
        public CalculatorTests()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <MockSettingsProvider>().AsImplementedInterfaces().SingleInstance();
            builder.RegisterType <AppConfigBricklinkCredentialProvider>().AsImplementedInterfaces().SingleInstance();

            _container = DependencyInjectionConfig.Setup(builder);
        }
コード例 #23
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     DependencyInjectionConfig.Setup();
 }
コード例 #24
0
        protected void Application_Start()
        {
#if DEBUG
            LogManager.AddDebugListener(true);
#endif

            DependencyInjectionConfig.RegisterServiceLocatorAsDependencyResolver();
            GlobalConfiguration.Configuration.DependencyResolver = new CatelWebApiDependencyResolver();
        }
コード例 #25
0
        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);
        }
コード例 #26
0
        // 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());
            });
        }
コード例 #27
0
        public ColorServiceTests()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <AppConfigBricklinkCredentialProvider>().AsImplementedInterfaces().SingleInstance();

            var container = DependencyInjectionConfig.Setup(builder);

            _service = container.Resolve <IColorService>();
        }
コード例 #28
0
        public void Setup()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <AppConfigBricklinkCredentialProvider>().AsImplementedInterfaces().SingleInstance();

            var container = DependencyInjectionConfig.Setup(builder);

            _api = container.Resolve <IBricklinkWantedListApi>();
        }
コード例 #29
0
        // 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);
        }
コード例 #30
0
        private TestCompositionRoot(IServiceCollection services, bool useFakes)
        {
            DependencyInjectionConfig.Configure(services, new ConfigurationRoot(new List <IConfigurationProvider>()));
            if (useFakes)
            {
                RegisterFakes(services);
            }

            _provider = services.BuildServiceProvider();
        }