本文整理汇总了C#中IPolicyList.GetNoDefault方法的典型用法代码示例。如果您正苦于以下问题:C# IPolicyList.GetNoDefault方法的具体用法?C# IPolicyList.GetNoDefault怎么用?C# IPolicyList.GetNoDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPolicyList
的用法示例。
在下文中一共展示了IPolicyList.GetNoDefault方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBehaviorsPolicy
/// <summary>
/// Get the list of behaviors for the current type so that it can be added to.
/// </summary>
/// <param name="policies">Policy list.</param>
/// <param name="implementationType">Implementation type to set behaviors for.</param>
/// <param name="name">Name type is registered under.</param>
/// <returns>An instance of <see cref="InterceptionBehaviorsPolicy"/>.</returns>
protected override InterceptionBehaviorsPolicy GetBehaviorsPolicy(IPolicyList policies, Type implementationType,
string name)
{
var policy = policies.GetNoDefault<IInterceptionBehaviorsPolicy>(implementationType, false);
if ((policy == null) || !(policy is InterceptionBehaviorsPolicy))
{
policy = new InterceptionBehaviorsPolicy();
policies.Set(policy, implementationType);
}
return (InterceptionBehaviorsPolicy) policy;
}
示例2: GetOrCreate
internal static InterceptionBehaviorsPolicy GetOrCreate(
IPolicyList policies,
Type typeToCreate,
string name)
{
NamedTypeBuildKey key = new NamedTypeBuildKey(typeToCreate, name);
IInterceptionBehaviorsPolicy policy =
policies.GetNoDefault<IInterceptionBehaviorsPolicy>(key, false);
if ((policy == null) || !(policy is InterceptionBehaviorsPolicy))
{
policy = new InterceptionBehaviorsPolicy();
policies.Set<IInterceptionBehaviorsPolicy>(policy, key);
}
return (InterceptionBehaviorsPolicy)policy;
}
示例3: GetOrCreate
internal static AdditionalInterfacesPolicy GetOrCreate(
IPolicyList policies,
Type typeToCreate,
string name)
{
NamedTypeBuildKey key = new NamedTypeBuildKey(typeToCreate, name);
IAdditionalInterfacesPolicy policy =
policies.GetNoDefault<IAdditionalInterfacesPolicy>(key, false);
if ((policy == null) || !(policy is AdditionalInterfacesPolicy))
{
policy = new AdditionalInterfacesPolicy();
policies.Set<IAdditionalInterfacesPolicy>(policy, key);
}
return (AdditionalInterfacesPolicy)policy;
}
示例4: GetSelectorPolicy
private static SpecifiedPropertiesSelectorPolicy GetSelectorPolicy(IPolicyList policies, Type typeToInject, string name)
{
var key = new NamedTypeBuildKey(typeToInject, name);
var selector =
policies.GetNoDefault<IPropertySelectorPolicy>(key, false);
if (selector == null)
{
var defaultSelector =
policies.Get<IPropertySelectorPolicy>(key, false) as FullAutowirePropertySelectorPolicy;
if (defaultSelector != null)
{
selector = defaultSelector.Clone();
policies.Set(selector, key);
}
else
{
throw new InvalidOperationException("Cannot use AutiviewEnabledInjectionProperty without FullAutowireContainerExtension. Please register FullAutowireContainerExtension extension in the container.");
}
}
return ((FullAutowirePropertySelectorPolicy)selector).SpecifiedPropertiesPolicy;
}
示例5: GetSelectorPolicy
private static SpecifiedPropertiesSelectorPolicy GetSelectorPolicy(IPolicyList policies, Type typeToInject, string name)
{
NamedTypeBuildKey key = new NamedTypeBuildKey(typeToInject, name);
IPropertySelectorPolicy selector =
policies.GetNoDefault<IPropertySelectorPolicy>(key, false);
if (selector == null || !(selector is SpecifiedPropertiesSelectorPolicy))
{
selector = new SpecifiedPropertiesSelectorPolicy();
policies.Set<IPropertySelectorPolicy>(selector, key);
}
return (SpecifiedPropertiesSelectorPolicy)selector;
}
示例6: GetSelectorPolicy
private static SpecifiedMethodsSelectorPolicy GetSelectorPolicy(IPolicyList policies, Type typeToCreate, string name)
{
var key = new NamedTypeBuildKey(typeToCreate, name);
var selector = policies.GetNoDefault<IMethodSelectorPolicy>(key, false);
if (selector == null || !(selector is SpecifiedMethodsSelectorPolicy))
{
selector = new SpecifiedMethodsSelectorPolicy();
policies.Set<IMethodSelectorPolicy>(selector, key);
}
return (SpecifiedMethodsSelectorPolicy)selector;
}