Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("AllowAll",
                                  builder =>
                {
                    builder
                    .AllowAnyOrigin()
                    .AllowAnyMethod()
                    .AllowAnyHeader()
                    .AllowCredentials();
                });
            });
            services.AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            .AddJsonOptions(
                options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                );


            services.AddFirebaseAuthentication(Configuration.GetValue <string>("Firebase:ProjectId"));

            if (Configuration.GetValue <bool>("UseLocalSignalR"))
            {
                services.AddSignalR();
            }
            else
            {
                services.AddSignalR().AddAzureSignalR();
            }

            services.AddHttpContextAccessor();
            services.AddScoped <ICurrentUser, CurrentUser>();

            BusinessLogicModule.ConfigureServices(services, Configuration);
            CommonModule.ConfigureServices(services);
            CoreModule.ConfigureServices(services);
            DataAccessModule.ConfigureServices(services, Configuration);
        }