Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //services.AddDbContext<MachineRemoteControlContext>(options =>
            //    options.UseSqlServer(Configuration.GetConnectionString("BattleRoyaleSolutionsContext")));

            services.AddAutoMapper();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // In production, the React files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/build";
            });

            services.AddCors(options => options.AddPolicy("CorsPolicy",
                                                          builder =>
            {
                builder.AllowAnyMethod().AllowAnyHeader()
                .WithOrigins("http://localhost:60748")
                .AllowCredentials();
            }));

            //Add SignalR as part of the middleware pipeline
            services.AddSignalR();

            Provider = services.BuildServiceProvider();

            DependencyInjectionResolver.RegisterServices(services);
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddDbContext <SisConTradContex>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            Provider = services.BuildServiceProvider();

            DependencyInjectionResolver.RegisterServices(services);
        }
Exemple #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            #region Swagger Configuration
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo
                {
                    Title       = "2DFrango API",
                    Version     = "v1",
                    Description = "Api referente ao Projeto desenvonvido no Hackathon Mega Hack."
                });
            });
            #endregion

            services.AddDbContext <_2dFrangoContext>();

            #region CORS
            services.AddCors(c =>
            {
                c.AddDefaultPolicy(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
            });
            #endregion

            #region Social Logins
            services.AddAuthentication(options =>
            {
                options.DefaultScheme          = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme = GoogleDefaults.AuthenticationScheme;
            })
            .AddCookie()
            .AddFacebook(config =>
            {
                config.AppId     = "234918024486588";
                config.AppSecret = "39ce8db252a9e7968fba7b0a302cd9fe";
            })
            .AddGoogle(config =>
            {
                config.ClientId     = "419273351615-a2kp1blvs5f3idt3mlr5vbkeqtqgjvr6.apps.googleusercontent.com";
                config.ClientSecret = "xkF4sgzzPO8MP9eHmLmp8Gwv";
            });
            #endregion

            DependencyInjectionResolver.RegisterServices(services, Configuration);
        }
Exemple #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy", builder => builder.SetIsOriginAllowed(_ => true).AllowAnyMethod().AllowAnyHeader().AllowCredentials().Build());
            });

            services.AddDbContext <FinancialChatContext>
                (options => options.UseSqlServer(Configuration.GetConnectionString("FinancialChatConnection")));
            //(options => options.UseSqlServer("Server=localhost,1433;Database=financial;User=sa;Password=dev@1234"));

            services.AddIdentitySetup(Configuration);

            AutoMapperConfig.RegisterMappings();

            services.AddSwaggerSetup();

            services.AddSingleton(AutoMapperConfig.RegisterMappings().CreateMapper());

            services.AddMvc();
            services.AddLogging();

            services.AddHttpClient("FinancialChat", cfg => { cfg.Timeout = TimeSpan.FromSeconds(60); });

            services.AddHttpContextAccessor();

            services.AddMediatR(typeof(Startup));
            services.Configure <RabbitMqOptions>(options => Configuration.GetSection("RabbitMqConfig").Bind(options));
            services.AddMassTransitSetup(Configuration.GetSection("RabbitMqConfig").Get <RabbitMqOptions>());

            DependencyInjectionResolver.RegisterServices(services);

            services.AddSignalR(hubOptions =>
            {
                hubOptions.EnableDetailedErrors  = true;
                hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(15);
                //hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(10);
            });
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            FilterConfig.ConfigureServices(services);

            DependencyInjectionResolver.ConfigureServices(services);

            JsonFormatConfig.ConfigureServices(services);

            SwaggerConfig.ConfigureServices(services);

            AutoMapperConfig.ConfigureServices(services);

            AuthConfig.ConfigureServices(services);

            DbConfig.ConfigureServices(services, Configuration);

            //sql connection
            services.AddRouting(options => options.LowercaseUrls = true);

            services.AddControllers();

            CorsConfig.ConfigureServices(services);
        }
        static void Main(string[] args)
        {
            var driver = DependencyInjectionResolver.Resolve <IDriver>();

            driver.Run();
        }
 public static void AddDIConfiguration(this IServiceCollection services)
 {
     DependencyInjectionResolver.RegisterServices(services);
 }
Exemple #8
0
 public static void Run()
 {
     // Configure Autofac Dependency Resolver
     DependencyInjectionResolver.Initialize(GlobalConfiguration.Configuration);
 }
 public static void AddDependencies(this IServiceCollection services, IConfiguration configuration)
 {
     DependencyInjectionResolver.Configure(services, configuration);
 }