Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Api Rest Configuration
            RestServiceConfiguration.ConfigureServices(services);

            // Database configuration
            DatabaseConfiguration.ConfigureServices(services, Configuration);

            // Identity service configuration
            IdentityServiceConfiguration.ConfigureServices(services, Configuration);

            // Authorization
            AppAuthorizationConfiguration.ConfigureAuthorization(services);

            // Authentication configuration
            AuthenticationConfiguration.ConfigureServices(services, Configuration);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "DavidMorales.WebHost", Version = "v1"
                });
            });



            // Identity
            services.AddTransient <AppIdentity>();
            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();

            // Log
            services.AddLogging();

            // Cors
            services.AddCors();
        }