예제 #1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureContainer(ServiceRegistry services)
 {
     services.AddCorrelationId();
     services.AddHttpContextAccessor();
     services.AddMvc();
     services.AddVersionedApiExplorer(options => options.GroupNameFormat = "'v'VVV");
     services.AddApiVersioning(o =>
     {
         o.ReportApiVersions = true;
         o.DefaultApiVersion = new ApiVersion(1, 0);
         o.AssumeDefaultVersionWhenUnspecified = true;
     });
     services.AddOptions();
     services.AddHttpClient();
     services.AddSwagger(Configuration);
     services.AddDependencyInjection(Configuration);
     services.AddControllers();
     services.AddHealthChecks();
     services.AddSwaggerGen(c =>
     {
         // This coupled with the properties in the csproj allow the swagger page to show additional comments for methods
         var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
         var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
         c.IncludeXmlComments(xmlPath);
     });
 }