Example #1
0
        public static void AddExtentions(this IServiceCollection services, IConfiguration configuration)
        {
            var infos = new ApiInfos {
                ApiDescription = $"{Resources.ApiInfos.Name} - {Resources.ApiInfos.ApiName}"
            };

            services.SetApiVersion();
            services.SetSwagger(infos);
        }
        public static void SetSwagger(this IServiceCollection services, ApiInfos apiInfos)
        {
            _apiInfos = apiInfos;
            services.SetApiVersion();
            services.AddTransient <IConfigureOptions <SwaggerGenOptions>, ConfigureSwaggerOptions>();

            services.AddSwaggerGen(config =>
            {
                config.TagActionsBy(api => api.GroupBySwaggerGroupAttribute());
                config.SetXmlDocumentation();
            });
            services.AddSwaggerGenNewtonsoftSupport();
        }