Пример #1
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.Configure <EmailSettings>(Configuration.GetSection("EmailSettings"));
            services.AddTransient <IEmailSender, AuthMessageSender>();
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            _services = services;
            RepositoryConfig.Configure(_services, Configuration);
            ServicesConfig.Configure(_services);
        }
Пример #2
0
        public void ConfigureServices(IServiceCollection services)
        {
            ConfigureAuthentication(services);
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            .AddJsonOptions(
                op =>
            {
                op.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
                op.SerializerSettings.NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore;
            }
                );
            services.AddCors();
            _services = services;
            RepositoryConfig.Configure(_services, Configuration);
            ServicesConfig.Configure(_services);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = Configuration["ApiConfigs:Title"], Version = "v1"
                });
            });
        }
Пример #3
0
 public void ConfigureServices(IServiceCollection services)
 {
     RepositoryConfig.Configure(services, Configuration);
     ServicesConfig.Configure(services, Configuration);
 }