本文整理汇总了C#中IAppHost.GetPlugin方法的典型用法代码示例。如果您正苦于以下问题:C# IAppHost.GetPlugin方法的具体用法?C# IAppHost.GetPlugin怎么用?C# IAppHost.GetPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAppHost
的用法示例。
在下文中一共展示了IAppHost.GetPlugin方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
public void Register(IAppHost appHost)
{
appHost.CatchAllHandlers.Add(ProcessRequest);
appHost.GetPlugin<MetadataFeature>()
.AddDebugLink("?debug=requestinfo", "Request Info");
}
示例2: Register
public void Register(IAppHost appHost)
{
appHost.CatchAllHandlers.Add(ProcessRequest);
appHost.GetPlugin<MetadataFeature>()
.AddDebugLink($"?{Keywords.Debug}={Keywords.RequestInfo}", "Request Info");
}
示例3: Register
public void Register(IAppHost appHost)
{
if (ResourceFilterPattern != null)
SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);
SwaggerApiService.UseCamelCaseModelPropertyNames = UseCamelCaseModelPropertyNames;
SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = UseLowercaseUnderscoreModelPropertyNames;
SwaggerApiService.DisableAutoDtoInBodyParam = DisableAutoDtoInBodyParam;
SwaggerApiService.ModelFilter = ModelFilter;
SwaggerApiService.ModelPropertyFilter = ModelPropertyFilter;
appHost.RegisterService(typeof(SwaggerResourcesService), new[] { "/resources" });
appHost.RegisterService(typeof(SwaggerApiService), new[] { SwaggerResourcesService.RESOURCE_PATH + "/{Name*}" });
var swaggerUrl = UseBootstrapTheme
? "swagger-ui-bootstrap/"
: "swagger-ui/";
appHost.GetPlugin<MetadataFeature>()
.AddPluginLink(swaggerUrl, "Swagger UI");
appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) =>
{
IVirtualFile indexFile;
switch (pathInfo)
{
case "/swagger-ui":
case "/swagger-ui/":
case "/swagger-ui/default.html":
indexFile = appHost.VirtualPathProvider.GetFile("/swagger-ui/index.html");
break;
case "/swagger-ui-bootstrap":
case "/swagger-ui-bootstrap/":
case "/swagger-ui-bootstrap/index.html":
indexFile = appHost.VirtualPathProvider.GetFile("/swagger-ui-bootstrap/index.html");
break;
default:
indexFile = null;
break;
}
if (indexFile != null)
{
var html = indexFile.ReadAllText();
return new CustomResponseHandler((req, res) =>
{
res.ContentType = MimeTypes.Html;
var resourcesUrl = req.ResolveAbsoluteUrl("~/resources");
html = html.Replace("http://petstore.swagger.wordnik.com/api/api-docs", resourcesUrl)
.Replace("ApiDocs", HostContext.ServiceName)
.Replace("{LogoUrl}", LogoUrl);
return html;
});
}
return pathInfo.StartsWith("/swagger-ui") ? new StaticFileHandler() : null;
});
}
示例4: Register
public void Register(IAppHost appHost)
{
appHost.RegisterService<PostmanService>(AtRestPath);
appHost.GetPlugin<MetadataFeature>()
.AddPluginLink(AtRestPath.TrimStart('/'), "Postman Metadata");
if (EnableSessionExport == null)
EnableSessionExport = appHost.Config.DebugMode;
}
示例5: Register
public void Register(IAppHost appHost)
{
var s = AuthenticateService.CurrentSessionFactory() as IWebSudoAuthSession;
if (s == null)
{
throw new NotSupportedException("The IUserAuth session must also implement IWebSudoAuthSession");
}
appHost.GlobalRequestFilters.Add(OnRequestStart);
appHost.GlobalResponseFilters.Add(OnRequestEnd);
var authFeature = appHost.GetPlugin<AuthFeature>();
authFeature.AuthEvents.Add(this);
}
示例6: Register
public void Register(IAppHost appHost)
{
var indexHtml = appHost.VirtualFileSources.GetFile("ss_admin/index.html").ReadAllText();
appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) =>
pathInfo.StartsWith("/ss_admin")
? (pathInfo == "/ss_admin/index.html" || !appHost.VirtualFileSources.FileExists(pathInfo)
? new CustomActionHandler((req, res) => {
res.ContentType = MimeTypes.Html;
res.Write(indexHtml.Replace("/ss_admin", req.ResolveAbsoluteUrl("~/ss_admin")));
}) as IHttpHandler
: new StaticFileHandler(appHost.VirtualFileSources.GetFile(pathInfo)))
: null);
appHost.GetPlugin<MetadataFeature>()
.AddPluginLink("ss_admin/autoquery/", "AutoQuery Viewer");
}
示例7: Register
public void Register(IAppHost appHost)
{
// HACK: not great but unsure how to improve
// throws exception if WebHostUrl isn't set as this is how we get endpoint url:port
if (appHost.Config?.WebHostUrl == null)
throw new ApplicationException("appHost.Config.WebHostUrl must be set to use the Consul plugin, this is so consul will know the full external http://url:port for the service");
// register callbacks
appHost.AfterInitCallbacks.Add(RegisterService);
appHost.OnDisposeCallbacks.Add(UnRegisterService);
appHost.RegisterService<HealthCheckService>();
appHost.RegisterService<DiscoveryService>();
// register plugin link
appHost.GetPlugin<MetadataFeature>()?.AddPluginLink(ConsulUris.LocalAgent.CombineWith("ui"), "Consul Agent WebUI");
}
示例8: Register
public void Register(IAppHost appHost)
{
if (ResourceFilterPattern != null)
SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);
SwaggerApiService.UseCamelCaseModelPropertyNames = UseCamelCaseModelPropertyNames;
SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = UseLowercaseUnderscoreModelPropertyNames;
SwaggerApiService.DisableAutoDtoInBodyParam = DisableAutoDtoInBodyParam;
SwaggerApiService.ModelFilter = ModelFilter;
SwaggerApiService.ModelPropertyFilter = ModelPropertyFilter;
appHost.RegisterService(typeof(SwaggerResourcesService), new[] { "/resources" });
appHost.RegisterService(typeof(SwaggerApiService), new[] { SwaggerResourcesService.RESOURCE_PATH + "/{Name*}" });
var metadata = appHost.GetPlugin<MetadataFeature>();
if (metadata != null)
{
metadata.PluginLinks["swagger-ui/"] = "Swagger UI";
}
appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) =>
{
if (pathInfo == "/swagger-ui" || pathInfo == "/swagger-ui/" || pathInfo == "/swagger-ui/default.html")
{
var indexFile = appHost.VirtualPathProvider.GetFile("/swagger-ui/index.html");
if (indexFile != null)
{
var html = indexFile.ReadAllText();
return new CustomResponseHandler((req, res) =>
{
res.ContentType = MimeTypes.Html;
var resourcesUrl = req.ResolveAbsoluteUrl("~/resources");
html = html.Replace("http://petstore.swagger.wordnik.com/api/api-docs", resourcesUrl);
return html;
});
}
}
return null;
});
}
示例9: Register
public void Register(IAppHost appHost)
{
appHost.RegisterService<RequestLogsService>(AtRestPath);
var requestLogger = RequestLogger ?? new InMemoryRollingRequestLogger(Capacity);
requestLogger.EnableSessionTracking = EnableSessionTracking;
requestLogger.EnableResponseTracking = EnableResponseTracking;
requestLogger.EnableRequestBodyTracking = EnableRequestBodyTracking;
requestLogger.EnableErrorTracking = EnableErrorTracking;
requestLogger.RequiredRoles = RequiredRoles;
requestLogger.ExcludeRequestDtoTypes = ExcludeRequestDtoTypes;
requestLogger.HideRequestBodyForRequestDtoTypes = HideRequestBodyForRequestDtoTypes;
appHost.Register(requestLogger);
if (EnableRequestBodyTracking)
{
appHost.PreRequestFilters.Insert(0, (httpReq, httpRes) => {
httpReq.UseBufferedStream = EnableRequestBodyTracking;
});
}
appHost.GetPlugin<MetadataFeature>()
.AddDebugLink(AtRestPath, "Request Logs");
}
示例10: Register
public void Register(IAppHost appHost)
{
configValidator.ValidateAndThrow(this);
ConfigureRequestLogger(appHost);
appHost.RegisterService(typeof(SeqRequestLogConfigService));
if (EnableRequestBodyTracking)
{
appHost.PreRequestFilters.Insert(0, (httpReq, httpRes) =>
{
httpReq.UseBufferedStream = true;
});
}
appHost.GetPlugin<MetadataFeature>()
.AddDebugLink(SeqUrl, "Seq Request Logs")
.AddPluginLink("/SeqRequestLogConfig", "Seq IRequestLogger Configuration");
}