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


C# IAppHost类代码示例

本文整理汇总了C#中IAppHost的典型用法代码示例。如果您正苦于以下问题:C# IAppHost类的具体用法?C# IAppHost怎么用?C# IAppHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IAppHost类属于命名空间,在下文中一共展示了IAppHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Register

        /// <summary>
        /// 
        /// </summary>
        /// <param name="appHost"></param>
        public void Register( IAppHost appHost )
        {
            Verify.ArgumentNotNull(appHost, "appHost");

            _appHost = appHost;
            _appHost.GlobalRequestFilters.Add((req, res, dto) => ProcessRequest(req, res, dto));
        }
开发者ID:jdmartinez,项目名称:Northwind,代码行数:11,代码来源:QueryLanguageFeature.cs

示例2: S3VirtualPathProvider

 public S3VirtualPathProvider(IAmazonS3 client, string bucketName, IAppHost appHost)
     : base(appHost)
 {
     this.AmazonS3 = client;
     this.BucketName = bucketName;
     this.rootDirectory = new S3VirtualDirectory(this, null);
 }
开发者ID:derFunk,项目名称:ServiceStack.Aws,代码行数:7,代码来源:S3VirtualPathProvider.cs

示例3: AfterPluginsLoaded

        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (container.Exists<IpModuleManager>())
            {
                var manager = container.Resolve<IpModuleManager>();

                manager.DeviceStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}[{2}]", args.Device.Name, args.Device.Status, args.Device.ZoneId);
                    var settings = container.Resolve<SmartThingsSettings>();
                    var cb = new SmartThingsCallbacks(settings);
                    cb.PutDeviceUpdate(args.Device);
                };

                manager.PartitionStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}", args.Partition.Name, args.Partition.Status);
                    var settings = container.Resolve<SmartThingsSettings>();
                    var cb = new SmartThingsCallbacks(settings);
                    cb.PutPartitionUpdate(args.Partition);
                };
            }
            else
            {
                logger.Error("Cannot find Ip Module Manager to register device and partition status changes events for SmartThings");
            }

        }
开发者ID:norm472,项目名称:ParadoxAlarmControl,代码行数:30,代码来源:SmartThingsPlugin.cs

示例4: Register

        public void Register(IAppHost appHost)
        {
            appHost.GlobalResponseFilters.Add(filter);

            if (ApplyToMessaging)
                appHost.GlobalMessageResponseFilters.Add(filter);
        }
开发者ID:AVee,项目名称:ServiceStack,代码行数:7,代码来源:CustomRequestFilter.cs

示例5: Register

 /// <summary>
 /// Activate the validation mechanism, so every request DTO with an existing validator
 /// will be validated.
 /// </summary>
 /// <param name="appHost">The app host</param>
 public void Register(IAppHost appHost)
 {
     if (Enabled) return;
     Enabled = true;
     var filter = new ValidationFilters();
     appHost.RequestFilters.Add(filter.RequestFilter);
 }
开发者ID:grammarware,项目名称:fodder,代码行数:12,代码来源:src_ServiceStack_ServiceInterface_Validation_ValidationFeature.cs

示例6: Register

        public void Register(IAppHost appHost)
        {
            if (alreadyConfigured) return;
                alreadyConfigured = true;

            appHost.GlobalRequestFilters.Add(ExtractTokenFromRequestFilter);
        }
开发者ID:jlyonsmith,项目名称:ToolBelt,代码行数:7,代码来源:LoginTokenFeature.cs

示例7: 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

示例8: AbstractVirtualPathProviderBase

        protected AbstractVirtualPathProviderBase(IAppHost appHost)
        {
            if (appHost == null)
                throw new ArgumentNullException("appHost");

            AppHost = appHost;
        }
开发者ID:rajeshpillai,项目名称:ServiceStack,代码行数:7,代码来源:AbstractVirtualPathProviderBase.cs

示例9: Register

 public void Register(IAppHost appHost)
 {
     // Get all of the services in this assembly that inherit from ServiceStackService
     GetType().Assembly.GetTypes().Where(a => a.BaseType == typeof(Service)).ToList()
         // Register the Service
         .Each(service => appHost.RegisterService(service));
 }
开发者ID:ryanhelms,项目名称:ServiceStack.Contrib,代码行数:7,代码来源:UptimeFeature.cs

示例10: Register

 public void Register(IAppHost appHost)
 {
     if (ResourceFilterPattern != null)
         SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);
     appHost.RegisterService(typeof (SwaggerResourcesService), new string[] {"/resources"});
     appHost.RegisterService(typeof(SwaggerApiService), new string[] { "/resource/{Name*}" });
 }
开发者ID:keith512,项目名称:ServiceStack,代码行数:7,代码来源:SwaggerFeature.cs

示例11: Register

        public void Register(IAppHost appHost)
        {
            appHost.Register<INativeTypesMetadata>(
                new NativeTypesMetadata(appHost.Metadata, MetadataTypesConfig));

            appHost.RegisterService<NativeTypesService>();
        }
开发者ID:vebin,项目名称:soa,代码行数:7,代码来源:NativeTypesFeature.cs

示例12: AspNetWindowsAuthProvider

        public AspNetWindowsAuthProvider(IAppHost appHost)
        {
            Provider = Name;
            AuthRealm = Realm;

            AllRoles = new List<string>();
            LimitAccessToRoles = new List<string>();

            if (!(appHost is AppHostBase))
            {
                throw new NotSupportedException(
                    "AspNetWindowsAuthProvider is only supported on ASP.NET hosts");
            }

            //Add all pre-defined Roles used to in App to 'AllRoles'
            appHost.AfterInitCallbacks.Add(host =>
            {
                var requiredRoles = host.Metadata.OperationsMap
                    .SelectMany(x => x.Key.AllAttributes<RequiredRoleAttribute>()
                        .Concat(x.Value.ServiceType.AllAttributes<RequiredRoleAttribute>()))
                    .SelectMany(x => x.RequiredRoles);

                requiredRoles.Each(x => AllRoles.AddIfNotExists(x));
            });
        }
开发者ID:CLupica,项目名称:ServiceStack,代码行数:25,代码来源:AspNetWindowsAuthProvider.cs

示例13: Register

 public void Register( IAppHost appHost )
 {
     this.AppHost = appHost;
     this.ViewManager = new ViewManager( appHost, this.ViewConfig );
     this.BuildManager = new BuildManager( appHost, this.BuildConfig );
     this.PageResolver = new PageResolver( appHost, this.ResolveConfig, this.ViewManager, this.BuildManager );
 }
开发者ID:HansS,项目名称:ServiceStack,代码行数:7,代码来源:RazorFormat.cs

示例14: Register

        public void Register(IAppHost appHost)
        {
            if (isInstalled) return;
            isInstalled = true;

            if (!string.IsNullOrEmpty(allowedOrigins) && allowOriginWhitelist == null)
                appHost.Config.GlobalResponseHeaders.Add(HttpHeaders.AllowOrigin, allowedOrigins);
            if (!string.IsNullOrEmpty(allowedMethods))
                appHost.Config.GlobalResponseHeaders.Add(HttpHeaders.AllowMethods, allowedMethods);
            if (!string.IsNullOrEmpty(allowedHeaders))
                appHost.Config.GlobalResponseHeaders.Add(HttpHeaders.AllowHeaders, allowedHeaders);
            if (allowCredentials)
                appHost.Config.GlobalResponseHeaders.Add(HttpHeaders.AllowCredentials, "true");

            if (allowOriginWhitelist != null)
            {
                appHost.GlobalRequestFilters.Add((httpReq, httpRes, requestDto) =>
                    {
                        var origin = httpReq.Headers.Get("Origin");
                        if (allowOriginWhitelist.Contains(origin))
                        {
                            httpRes.AddHeader(HttpHeaders.AllowOrigin, origin);
                        }
                    });
            }
        }
开发者ID:remkoboschker,项目名称:ServiceStack,代码行数:26,代码来源:CorsFeature.cs

示例15: Register

        public void Register(IAppHost appHost)
        {
            appHost.Routes.Add(typeof(GetAssetClassRequest), "/rest/assetclasses", "GET");
            appHost.Routes.Add(typeof(GetAssetClassRequest), "/rest/assetclasses/{AssetClass}", "GET");

            appHost.RegisterService(typeof(AssetClassService), "");
        }
开发者ID:docspy,项目名称:PSplusCFUI,代码行数:7,代码来源:AssetClassPlugin.cs


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