示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ConfigureService.ConfigureDependeciesService(services);
            ConfigurationRepository.ConfigureDependeciesRepository(services);
            ConfigurationContext.ConfigureDependeciesContext(services);

            var signingConfiguration = new SigningConfiguration();

            services.AddSingleton(signingConfiguration);

            var tokenConfiguration = new TokenConfiguration();

            new ConfigureFromConfigurationOptions <TokenConfiguration>(Configuration.GetSection("TokenConfiguration")).Configure(tokenConfiguration);

            services.AddSingleton(tokenConfiguration);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Api em .net core ", Description = "Projeto utilizado para fins didáticos", Version = "v1", Contact = new OpenApiContact
                    {
                        Name = "Uigor Silva Fonseca",
                        Url  = new Uri("https://github.com/uigormarshall")
                    }
                });
            });
            services.AddControllers();
        }