using System.Linq;
|
using System.Web.Http;
|
using System.Web.Http.Description;
|
using System.Web.Mvc;
|
using WebActivatorEx;
|
using Pcb.Api;
|
using Swashbuckle.Application;
|
using Swashbuckle.Swagger;
|
using System.Web.Http.Dispatcher;
|
using Pcb.Api.App_Start;
|
|
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
|
|
namespace Pcb.Api
|
{
|
/// <summary>
|
/// SwaggerConfig
|
/// </summary>
|
public class SwaggerConfig
|
{
|
/// <summary>
|
/// SwaggerConfig Register
|
/// </summary>
|
public static void Register()
|
{
|
|
var thisAssembly = typeof(SwaggerConfig).Assembly;
|
GlobalConfiguration.Configuration
|
.EnableSwagger(c =>
|
{
|
c.DocumentFilter(() => new MyDocumentFilter());
|
c.IgnoreObsoleteActions();
|
c.SingleApiVersion("v1", "½ÝÅäÍøAPIÎĵµ");
|
c.IncludeXmlComments(GetXmlCommentsPath());
|
})
|
.EnableSwaggerUi(c =>
|
{
|
// c.EnableDiscoveryUrlSelector();
|
});
|
}
|
|
private static string GetXmlCommentsPath()
|
{
|
return System.String.Format(@"{0}\bin\Pcb.Api.XML", System.AppDomain.CurrentDomain.BaseDirectory);
|
}
|
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public class MyDocumentFilter : IDocumentFilter
|
{
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="swaggerDoc"></param>
|
/// <param name="schemaRegistry"></param>
|
/// <param name="apiExplorer"></param>
|
public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer)
|
{
|
|
}
|
}
|
}
|