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


C# IPolicyList.Get方法代码示例

本文整理汇总了C#中IPolicyList.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IPolicyList.Get方法的具体用法?C# IPolicyList.Get怎么用?C# IPolicyList.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPolicyList的用法示例。


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

示例1: RemoveResolvers

 /// <summary>
 /// Remove the resolvers for the given build key.
 /// </summary>
 /// <param name="policies">Policy list containing the build key.</param>
 /// <param name="buildKey">Build key.</param>
 public static void RemoveResolvers(IPolicyList policies, object buildKey)
 {
     IDependencyResolverTrackerPolicy tracker = policies.Get<IDependencyResolverTrackerPolicy>(buildKey);
     if (tracker != null)
     {
         tracker.RemoveResolvers(policies);
     }
 }
开发者ID:kangkot,项目名称:unity,代码行数:13,代码来源:DependencyResolverTrackerPolicy.cs

示例2: GetMappedType

 private Type GetMappedType(IPolicyList policies)
 {
     var mappingPolicy = policies.Get<IBuildKeyMappingPolicy>(buildKey);
     if (mappingPolicy != null)
     {
         return mappingPolicy.Map(buildKey, null).Type;
     }
     return buildKey.Type;
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:9,代码来源:ContainerRegistration.cs

示例3: GetTracker

 // Helper methods for adding and removing the tracker policy.
 /// <summary>
 /// Get an instance that implements <see cref="IDependencyResolverTrackerPolicy"/>,
 /// either the current one in the policy set or creating a new one if it doesn't
 /// exist.
 /// </summary>
 /// <param name="policies">Policy list to look up from.</param>
 /// <param name="buildKey">Build key to track.</param>
 /// <returns>The resolver tracker.</returns>
 public static IDependencyResolverTrackerPolicy GetTracker(IPolicyList policies, object buildKey)
 {
     IDependencyResolverTrackerPolicy tracker =
         policies.Get<IDependencyResolverTrackerPolicy>(buildKey);
     if (tracker == null)
     {
         tracker = new DependencyResolverTrackerPolicy();
         policies.Set<IDependencyResolverTrackerPolicy>(tracker, buildKey);
     }
     return tracker;
 }
开发者ID:kangkot,项目名称:unity,代码行数:20,代码来源:DependencyResolverTrackerPolicy.cs

示例4: AddPolicies

 public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
 {
     var key = new NamedTypeBuildKey(implementationType, name);
     var policy = policies.Get<InterceptorPolicy>(key);
     if (policy == null)
     {
         policy = new InterceptorPolicy();
         policies.Set(policy, key);
     }
     
     policy.AddInterceptor(this.interceptorContainer);
 }
开发者ID:BrunoJuchli,项目名称:Unity.StaticProxyExtension,代码行数:12,代码来源:Intercept.cs

示例5: GetLifetimeManagerType

        private Type GetLifetimeManagerType(IPolicyList policies)
        {
            var key = new NamedTypeBuildKey(MappedToType, Name);
            var lifetime = policies.Get<ILifetimePolicy>(key);
            
            if(lifetime != null)
            {
                return lifetime.GetType();
            }

            if(MappedToType.IsGenericType)
            {
                var genericKey = new NamedTypeBuildKey(MappedToType.GetGenericTypeDefinition(), Name);
                var lifetimeFactory = policies.Get<ILifetimeFactoryPolicy>(genericKey);
                if(lifetimeFactory != null)
                {
                    return lifetimeFactory.LifetimeType;
                }
            }

            return typeof (TransientLifetimeManager);
        }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:22,代码来源:ContainerRegistration.cs

示例6: GetLifetimeManager

 private LifetimeManager GetLifetimeManager(IPolicyList policies)
 {
     var key = new NamedTypeBuildKey(MappedToType, Name);
     return (LifetimeManager)policies.Get<ILifetimePolicy>(key);
 }
开发者ID:CFMITL,项目名称:unity,代码行数:5,代码来源:ContainerRegistration.cs

示例7: 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)
             {
            FullAutowirePropertySelectorPolicy 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;
        }
开发者ID:togakangaroo,项目名称:NServiceBus,代码行数:22,代码来源:AutowireEnabledInjectionProperty.cs

示例8: ResolveValue

 private object ResolveValue(IPolicyList policies, string key)
 {
     IDependencyResolverPolicy resolver = policies.Get<IDependencyResolverPolicy>(key);
     return resolver.Resolve(null);
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:5,代码来源:InjectionConstructorFixture.cs


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