Created
February 17, 2019 00:53
-
-
Save felipebossolani/5397eb13455a59c56a75a52f5e7affdb to your computer and use it in GitHub Desktop.
Startup.cs - ConfigureServices Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Configurando o serviço de documentação do Swagger | |
services.AddSwaggerGen(c => | |
{ | |
c.SwaggerDoc("v1", | |
new Info | |
{ | |
Title = "Comparador de Fundos - Meuportfol.io", | |
Version = "v1", | |
Description = "Comparador de Fundos - Meuportfol.io. Para utilização nos procure para obter credencial", | |
Contact = new Contact | |
{ | |
Name = "Felipe Bossolani", | |
Url = "https://meuportfol.io" | |
} | |
}); | |
c.CustomSchemaIds(x => x.FullName); //Essa linha deve ser inserida em casos que há classes com mesmo nome em namespaces diferentes | |
//Obtendo o diretório e depois o nome do arquivo .xml de comentários | |
var applicationBasePath = PlatformServices.Default.Application.ApplicationBasePath; | |
var applicationName = PlatformServices.Default.Application.ApplicationName; | |
var xmlDocumentPath = Path.Combine(applicationBasePath, $"{applicationName}.xml"); | |
//Caso exista arquivo então adiciona-lo | |
if (File.Exists(xmlDocumentPath)) | |
{ | |
c.IncludeXmlComments(xmlDocumentPath); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment