当前位置: 首页>>代码示例>>C#>>正文


C# IAppHost.GetPlugin方法代码示例

本文整理汇总了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");
        }
开发者ID:vebin,项目名称:soa,代码行数:7,代码来源:RequestInfoFeature.cs

示例2: Register

        public void Register(IAppHost appHost)
        {
            appHost.CatchAllHandlers.Add(ProcessRequest);

            appHost.GetPlugin<MetadataFeature>()
                .AddDebugLink($"?{Keywords.Debug}={Keywords.RequestInfo}", "Request Info");
        }
开发者ID:AVee,项目名称:ServiceStack,代码行数:7,代码来源:RequestInfoFeature.cs

示例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;
            });
        }
开发者ID:BilliamBrown,项目名称:ServiceStack,代码行数:57,代码来源:SwaggerFeature.cs

示例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;
        }
开发者ID:jin29neci,项目名称:ServiceStack,代码行数:10,代码来源:PostmanFeature.cs

示例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);
        }
开发者ID:CLupica,项目名称:ServiceStack,代码行数:14,代码来源:WebSudoFeature.cs

示例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");
        }
开发者ID:ServiceStack,项目名称:Admin,代码行数:17,代码来源:AdminFeature.cs

示例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");
        }
开发者ID:MacLeanElectrical,项目名称:servicestack-discovery-consul,代码行数:17,代码来源:ConsulFeature.cs

示例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;
            });
        }
开发者ID:nunopimenta,项目名称:ServiceStack,代码行数:41,代码来源:SwaggerFeature.cs

示例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");
        }
开发者ID:BilliamBrown,项目名称:ServiceStack,代码行数:25,代码来源:RequestLogsFeature.cs

示例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");
        }
开发者ID:wwwlicious,项目名称:servicestack-seq-requestlogsfeature,代码行数:18,代码来源:SeqRequestLogsFeature.cs


注:本文中的IAppHost.GetPlugin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。