本文整理汇总了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));
}
示例2: S3VirtualPathProvider
public S3VirtualPathProvider(IAmazonS3 client, string bucketName, IAppHost appHost)
: base(appHost)
{
this.AmazonS3 = client;
this.BucketName = bucketName;
this.rootDirectory = new S3VirtualDirectory(this, null);
}
示例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");
}
}
示例4: Register
public void Register(IAppHost appHost)
{
appHost.GlobalResponseFilters.Add(filter);
if (ApplyToMessaging)
appHost.GlobalMessageResponseFilters.Add(filter);
}
示例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);
}
示例7: Register
public void Register(IAppHost appHost)
{
appHost.CatchAllHandlers.Add(ProcessRequest);
appHost.GetPlugin<MetadataFeature>()
.AddDebugLink($"?{Keywords.Debug}={Keywords.RequestInfo}", "Request Info");
}
示例8: AbstractVirtualPathProviderBase
protected AbstractVirtualPathProviderBase(IAppHost appHost)
{
if (appHost == null)
throw new ArgumentNullException("appHost");
AppHost = appHost;
}
示例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));
}
示例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*}" });
}
示例11: Register
public void Register(IAppHost appHost)
{
appHost.Register<INativeTypesMetadata>(
new NativeTypesMetadata(appHost.Metadata, MetadataTypesConfig));
appHost.RegisterService<NativeTypesService>();
}
示例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));
});
}
示例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 );
}
示例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);
}
});
}
}
示例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), "");
}