// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services, Configuration.GetConnectionString("connectionString")); var signingConfigurations = new SigningConfigurations(); services.AddSingleton(signingConfigurations); var tokenConfigurations = new TokenConfigurations(); new ConfigureFromConfigurationOptions <TokenConfigurations>( Configuration.GetSection("TokenConfigurations")) .Configure(tokenConfigurations); services.AddSingleton(tokenConfigurations); services.AddAuthentication(authOptions => { authOptions.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; authOptions.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(bearerOptions => { var paramsValidation = bearerOptions.TokenValidationParameters; paramsValidation.IssuerSigningKey = signingConfigurations.Key; paramsValidation.ValidAudience = tokenConfigurations.Audience; paramsValidation.ValidIssuer = tokenConfigurations.Issuer; paramsValidation.ValidateIssuerSigningKey = true; paramsValidation.ValidateLifetime = true; paramsValidation.ClockSkew = TimeSpan.Zero; }); services.AddAuthorization(auth => { auth.AddPolicy("bearer", new AuthorizationPolicyBuilder() .AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme) .RequireAuthenticatedUser().Build() ); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "EstudoDDDWebApi", Version = "v1" }); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //services.AddControllers(); ConfigureRopository.ConfigureDependeciesRepository(services); ConfigureService.ConfigureDependeciesService(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" }); }); services.AddMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => { builder .AllowAnyHeader() .AllowAnyMethod() .WithOrigins( "http://*****:*****@hotmail.com" } }); // Set the comments path for the Swagger JSON and UI. var xmlFile = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = System.IO.Path.Combine(AppContext.BaseDirectory, xmlFile); x.IncludeXmlComments(xmlPath); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services, Configuration.GetConnectionString("SqliteConnection")); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "DbServer Test API", Version = "v1" }); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); var signingConfigurations = new SigningConfigurations(); services.AddSingleton(signingConfigurations); //Instancia Unica var tokenConfigurations = new TokenConfigurations(); new ConfigureFromConfigurationOptions <TokenConfigurations> ( Configuration.GetSection("TokenConfigurations")) .Configure(tokenConfigurations); services.AddSingleton(tokenConfigurations); //Instancia Unica /* * services.AddSwaggerGen(c => * { * c.SwaggerDoc("v1", * new Info * { * Title = "Curso de AspNetCore", * Version = "v1", * Description = "Exemplo de API REST criada com o ASP.NET Core", * Contact = new Contact * { * Name = "João Paulo Leite Nascimento", * Url = "https://github.com/joaopaulolndev" * } * }); * }); */ services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "ASPNETCORE 3.0 - 2019", Version = "v1", Description = "Exemplo de API REST criada no curso", Contact = new OpenApiContact { Name = "João Paulo Leite Nascimento", Email = string.Empty, Url = new Uri("https://github.com/joaopaulolndev") }, }); }); services.AddControllers(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddControllers(); services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); services.AddMvc(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "API Desafio SyDy", Version = "v1" }); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureRepository.ConfigureDependenciesRepository(services); ConfigureService.ConfigureDependenciesServices(services); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Curso de AspNetCore", Version = "v1", Description = "Exemplo de Api REST criada com o ASP.NET Core" }); }); }
public void ConfigureServices(IServiceCollection services) { ConfigureRepository.ConfigureDependenciesRepository(services); ConfigureService.ConfigureDependenciesServices(services); var config = new MapperConfiguration(x => { x.AddProfile(new DtoToModelProfile()); }); IMapper mapper = config.CreateMapper(); services.AddSingleton(mapper); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "Video Monitoring API Doc", Description = "API implementada utilizando ASP.NET Core Web API version 3.1 \n" + "\nObservações importantes: \n" + "- Os vídeos devem ser enviados no formato de código Base64 na requisição HTTP \n" + "- Para iniciar a aplicação, você deve entrar no projeto Api.Application e rodar o comando \"dotnet restore\", para restaurar as dependências do projeto, depois rode o comando \"dotnet build\" para construir o projeto e por fim rode o comando \"dotnet run\" para iniciar a aplicação. \n" + "- Para que a aplicação funcione corretamente, modifique a string de conexão no arquivo VideoMonitoring.Infra.Data/Context/AppDbContext.cs e VideoMonitoring.Infra.CrossCutting/DependencyInjection/ConfigureRepository.cs apontando para a instância SQL Server do seu banco de dados local ou algum banco de dados na nuvem.\n", TermsOfService = new Uri("https://cla.opensource.microsoft.com/"), Contact = new OpenApiContact { Name = "Rodrigo Vaz", Email = "*****@*****.**", Url = new Uri("https://github.com/drigovz/") }, License = new OpenApiLicense { Name = "Use about CLA Open Source License", Url = new Uri("https://cla.opensource.microsoft.com/") } }); var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); }); services.AddControllers(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenceiesService(services); ConfigureRepository.ConfigureDependenceiesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Test API AirLiquide", Version = "v1", Description = "API Desenvolvida em AspNet.Core, com conceito DDD, Verbos de Crud com interação com o banco SQL Server, teste de integração das rota", Contact = new OpenApiContact { Name = "Anderson Nascimento" } }); }); services.AddControllers(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesService(services); services.AddControllers(); var config = new AutoMapper.MapperConfiguration(cfg => { cfg.AddProfile(new DtoToModelProfile()); cfg.AddProfile(new EntityToDtoProfile()); cfg.AddProfile(new ModelToEntityProfile()); }); IMapper mapper = config.CreateMapper(); services.AddSingleton(mapper); }
public IServiceCollection ConfigureServices(IServiceCollection services) { services.AddSingleton <IConfiguration>(provider => Configuration); ConfigureQueries.ConfigureDependenciesQueries(services); ConfigureRepository.ConfigureDependenciesRepository(services, Configuration); ConfigureService.ConfigureDependenciesService(services); //Add security context var signingConfiguration = new SigningConfiguration(); services.AddSingleton(signingConfiguration); var tokenConfiguration = new TokenConfiguration(); new ConfigureFromConfigurationOptions <TokenConfiguration>( Configuration.GetSection("TokenConfigurations")) .Configure(tokenConfiguration); services.AddSingleton(tokenConfiguration); services.AddAuthentication(authOptions => { authOptions.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; authOptions.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(bearerOptions => { var paramsValidation = bearerOptions.TokenValidationParameters; paramsValidation.IssuerSigningKey = signingConfiguration.Key; paramsValidation.ValidAudience = tokenConfiguration.Audience; paramsValidation.ValidIssuer = tokenConfiguration.Issuer; paramsValidation.ValidateIssuerSigningKey = true; paramsValidation.ValidateLifetime = true; paramsValidation.ClockSkew = TimeSpan.Zero; }); services.AddAuthorization(auth => { auth.AddPolicy("Bearer", new AuthorizationPolicyBuilder() .AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme) .RequireAuthenticatedUser().Build()); }); return(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services, Configuration); ConfigureServicesJWT.ConfiureToken(services, Configuration); services.AddSwaggerDocumentation("SGM.Cidadao"); var config = new AutoMapper.MapperConfiguration(cfg => { cfg.AddProfile(new EntityToDtoProfile()); }); IMapper mapper = config.CreateMapper(); services.AddSingleton(mapper); services.AddControllers(); }
public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenceService(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "API 1 em AppNetCore 2.2", Version = "v1", Contact = new Contact { Name = "Ednilson Luciano Cipolla", Url = "https://github.com/ednilsoncipolla" } }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Api Core 2.2 DDD", Version = "v1", Description = "API REST criada com o ASP.NET Core", Contact = new Contact { Name = "Joyce Couraça de Souza", Url = "https://www.linkedin.com/in/joyce-coura%C3%A7a-de-souza-b0a67b76/" } }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { MigratorServices.CreateService(Configuration["mysqlDb:connectionString"]); ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepositories(services); services.AddMvc(opt => opt.Filters.Add <NotificationFilter>()) .SetCompatibilityVersion(CompatibilityVersion.Version_3_0); services.AddMySqlDatabase(Configuration); services.AddNotificationPattern(); var signingConfigurations = new SigningConfigurations(); services.AddSingleton(signingConfigurations); var tokenConfiguration = new TokenConfigurations(); new ConfigureFromConfigurationOptions <TokenConfigurations>( Configuration.GetSection("TokenConfigurations")).Configure(tokenConfiguration); services.AddSingleton(tokenConfiguration); services.AddSwaggerFramework(environment, Configuration); services.AddAuthentication(authOptions => { authOptions.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; authOptions.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(bearerOptions => { var paramsValidation = bearerOptions.TokenValidationParameters; paramsValidation.IssuerSigningKey = signingConfigurations.SecurityKey; paramsValidation.ValidAudience = tokenConfiguration.Audience; paramsValidation.ValidIssuer = tokenConfiguration.Issuer; paramsValidation.ValidateIssuerSigningKey = true; paramsValidation.ClockSkew = TimeSpan.Zero; }); services.AddAuthorization(auth => { auth.AddPolicy("Bearer", new AuthorizationPolicyBuilder() .AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme) .RequireAuthenticatedUser().Build()); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependencyService(services); ConfigureRepository.ConfigureDependencyRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Curso AspNetCore 2.2", Version = "v1", Description = "Exemplo de API REST criada com .NET Core", Contact = new Contact { Name = "Lucas Manara Patriarca", Url = "https://github.com/lucasmanara" } }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Curso de AspNetCore 2.2 para teste do Git", Version = "v1", Description = "Exemplo de API REST criada com o ASP.NET Core", Contact = new Contact { Name = "Marcos Fabricio Rosa", Url = "https://github.com/mfrinfo" } }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "BibiTotem", Version = "v1", Description = "API REST BIBI TOTEM", Contact = new OpenApiContact { Name = "José Bruno", } } ); }); services.AddControllers(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "OpenBank API", Version = "v1", Description = "Api to Access Online Bank", Contact = new OpenApiContact { Name = "Lucky Seixas", Email = "*****@*****.**", Url = new Uri("https://github.com/seixaslucky") } }); }); services.AddControllers(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); var config = new AutoMapper.MapperConfiguration(cfg => { cfg.AddProfile(new DtoToModelProfile()); cfg.AddProfile(new EntityToDtoProfile()); cfg.AddProfile(new ModelToEntityProfile()); }); IMapper mapper = config.CreateMapper(); services.AddSingleton(mapper); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "Desafio API AspNetCore 2 - Na Prática", Description = "Arquitetura DDD", TermsOfService = new Uri("http://localhost"), Contact = new OpenApiContact { Name = "Sérgio Peres de Barros", Email = "*****@*****.**", Url = new Uri("http://localhost") }, License = new OpenApiLicense { Name = "Termo de Licença de Uso", Url = new Uri("http://localhost") } }); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); var signingConfigurations = new SigningConfigurations(); services.AddSingleton(signingConfigurations); var tokenConfigurations = new TokenConfigurations(); new ConfigureFromConfigurationOptions <TokenConfigurations>( Configuration.GetSection("TokenConfigurations")) .Configure(tokenConfigurations); services.AddSingleton(tokenConfigurations); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "Curso de API com AspNetCore", Description = "Arquitetura DDD", TermsOfService = new Uri("http://www.teste.com.br"), Contact = new OpenApiContact { Name = "Diogo", Email = "*****@*****.**", Url = new Uri("http://www.teste.com.br"), }, License = new OpenApiLicense { Name = "Termo de licença de uso", Url = new Uri("http://www.teste.com.br") } }); }); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddMemoryCache(); services.Configure <GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Fastest); services.AddResponseCompression(option => { option.Providers.Add <GzipCompressionProvider>(); }); ConfigureService.ConfigureDependeciesService(services); ConfigureRepository.ConfigureDependeciesRepository(services); string conStr = Configuration.GetConnectionString("DefaultConnection"); BaseContextHelpers.SetConnectionStr(conStr); var serverVersion = new MySqlServerVersion(new Version(5, 7, 17)); services.AddDbContextPool <BaseContext>( dbContextOptions => dbContextOptions .UseMySql(conStr, serverVersion) .EnableDetailedErrors() ); var ver = ServerVersion.AutoDetect(conStr); services.AddDbContext <BaseContext>(options => options.UseMySql(conStr, ver)); //CORS string[] hostPermitido = new string[] { "*", "http://localhost:3000", "http://localhost:3001" }; services.AddCors(options => { options.AddPolicy("PolicyCORS", builder => builder .WithOrigins(hostPermitido) .AllowAnyMethod() .AllowAnyHeader() ); }); }
private void ShowValues() { try { ObjServiceTrocaXMLConfig objSalvo = new ConfigureService().GetConfigService; txtDelayProcess.Text = GetAppSetting(objSalvo.appSettings, Option.DELAY_PROCCESS); txtPathDB.Text = RemovePontoVirgula(GetPathDB(objSalvo.connectionStrings.add)); txtPwdDB.Text = RemovePontoVirgula(GetPwd(objSalvo.connectionStrings.add)); txtUserDB.Text = RemovePontoVirgula(GetUser(objSalvo.connectionStrings.add)); txtPathLog.Text = RemovePontoVirgula(GetAppSetting(objSalvo.appSettings, Option.PATH_LOG)); txtPathWebService.Text = RemovePontoVirgula(objSalvo.systemServiceModel.client.endpoint.address); cbSaveXML.Checked = GetSaveXML(objSalvo.appSettings, Option.SAVE_XML); } catch (Exception ex) { string msg = string.Format("{0}{1}{2}{1}", MessagesOfReturn.ErrorOpenFileConfig, Environment.NewLine, ex.Message); MessageBox.Show(this, msg, MessagesOfReturn.ErrorInfo, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); this.Dispose(); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "API AspNetCore 3.1", Description = "API simples, com Design Pattern DDD e sem autenticação.", Version = "1.0.0", Contact = new OpenApiContact { Name = "Jonathan de Toni", Url = new Uri("https://github.com/jonathandetoni"), Email = "*****@*****.**" } }); }); services.AddControllers(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "ASP.NET Core 2.2 C# API REST com arquitetura DDD na Prática", Version = "v1", Description = "Exemplo de API REST criada no curso", Contact = new OpenApiContact { Name = "Marcos Fabricio Rosa", Url = new Uri("https://github.com/mfrinfo") } }); }); services.AddControllers(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "API NetCore 3.1", Description = "Arquitetura DDD", TermsOfService = new Uri("http://www.github.com/lfgemi"), Contact = new OpenApiContact { Name = "Luiz Fernando Gemi", Email = "*****@*****.**", Url = new Uri("http://www.github.com/lfgemi"), }, License = new OpenApiLicense { Name = "Termo de Licença de Uso", Url = new Uri("http://www.github.com/lfgemi") } }); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //adiciono as configuração de injeção de dependencia. ConfigureService.ConfigurarInjecaoDeDependencias(services); ConfigureRepository.ConfigurarInjecaoDeDependencias(services); services.AddControllers(); //Adiciono middleware, swagger services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Version = "v1", Title = "S3 Soluções - CRMw", Contact = new Microsoft.OpenApi.Models.OpenApiContact { Name = "Vitor Fraga Suzarte", Email = "*****@*****.**", Url = new Uri("https://www.linkedin.com/in/suzartevitor/") } }); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //Registrando as interfaces (CrossCutting) ConfigureService.ConfigureDependenciesService(services); //Registrando Repositorios ConfigureRepository.ConfigureDependenciesRepository(services); // SWAGGER: Gerador de documentação automatizada // Explicação breve: https://en.wikipedia.org/wiki/Swagger_(software) // site do projeto: https://swagger.io/ // Repositorio do pacote usado: https://github.com/domaindrivendev/Swashbuckle.AspNetCore // Swagger -- Adicionando Documentação services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "API com Asp Net Core (2.2)", Version = "v1", Description = "Exemplo de API com Asp .Net Core", Contact = new OpenApiContact { Name = "Cesar Oliveira Jr", Email = "*****@*****.**", Url = new Uri("http://github.com/oliveiraugusto") } } ); } ); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //Adiciona dependencias de custom config ConfigureService.ConfigureDependenciesService(services); ConfigureRepository.ConfigureDependenciesRepository(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Aspnet 2.2", Version = "v1", Description = "Estudo documentação api", Contact = new Contact { Name = "Glauco Diogo", Email = "*****@*****.**", Url = "github" } }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddOptions(); var appSettings = Configuration.GetSection("AppSettings"); services.Configure <AppSettings>(appSettings); ConfigureService.ConfigureDependenciesServices(services); services.AddSingleton <IConfiguration>(Configuration); services.AddCors(); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Title = "Copa Filmes", Version = "v1", Description = "Copa Filmes WebAPI" }); c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); } ); }