Beispiel #1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     RepositoryDependencies.ConfigureRepositoryDependencies(services);
     ServicesDependencies.ConfigureServicesDependencies(services);
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new OpenApiInfo {
             Title = "BookStoreAPI", Version = "v1"
         });
     });
     services.AddControllers();
 }
Beispiel #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.AddAuthentication("LoginCookie").AddCookie("LoginCookie", options =>
     {
         options.AccessDeniedPath = "/account/denied";
         options.LoginPath        = "/account/login";
     });
     services = new HelperDependencies().BuildDependencies(services);
     services = new ServiceDependencies().BuildDependencies(services);
     services = new RepositoryDependencies().BuildDependencies(services);
     services = new MapperDependanices().BuildDependencies(services);
     services.AddHttpContextAccessor();
     services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
 }