예제 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var config = new MapperConfiguration(new MapperProfile());
            var mapper = config.CreateMapper();

            services.AddSingleton <IMapper>(mapper);
            services.AddScoped <SessionDto>();

            services.AddScoped <AuthController>();
            services.AddScoped <SignUpController>();
            services.AddScoped <UserProfileController>();

            services.AddScoped <MyDbContext>();
            services.AddScoped <IUsersRepository, UsersRepository>();
            services.AddScoped <ISessionRepository, SessionRepository>();

            services.AddControllers();
            services.AddSwaggerGen();
            services.AddMvc(options =>
            {
                options.Filters.Add(typeof(ValidatorActionFilter));
            })
            .AddJsonOptions(opts =>
            {
                opts.JsonSerializerOptions.Converters.Add(new System.Text.Json.Serialization.JsonStringEnumConverter());
            });
            MobileIdStartup.ConfigureServices(services);
        }
예제 #2
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
 {
     app.Map("", delegate(IApplicationBuilder mappedApp) { Configure1(mappedApp, env); })
     .Map("/mobileId", delegate(IApplicationBuilder mappedApp) { MobileIdStartup.Configure1(mappedApp, env, "/mobileId"); });
 }