• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IPolicyList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AddPolicies

 /// <summary>
 /// Add policies to the <paramref name="policies"/> to configure the
 /// container to call this constructor with the appropriate parameter values.
 /// </summary>
 /// <param name="typeToCreate">Type to register.</param>
 /// <param name="name">Name used to resolve the type object.</param>
 /// <param name="policies">Policy list to add policies to.</param>
 public override void AddPolicies(Type typeToCreate, string name, IPolicyList policies)
 {
     ConstructorInfo ctor = FindConstructor(typeToCreate);
     policies.Set<IConstructorSelectorPolicy>(
         new SpecifiedConstructorSelectorPolicy(ctor, parameterValues.ToArray()),
         new NamedTypeBuildKey(typeToCreate, name));
 }
开发者ID:shhyder,项目名称:application,代码行数:14,代码来源:InjectionConstructor.cs


示例2: ContainerRegistration

 internal ContainerRegistration(Type registeredType, string name, IPolicyList policies)
 {
     this.buildKey = new NamedTypeBuildKey(registeredType, name);
     MappedToType = GetMappedType(policies);
     LifetimeManagerType = GetLifetimeManagerType(policies);
     LifetimeManager = GetLifetimeManager(policies);
 }
开发者ID:CFMITL,项目名称:unity,代码行数:7,代码来源:ContainerRegistration.cs


示例3: SelectMethods

 /// <summary>
 ///   Return the sequence of methods to call while building the target object.
 /// </summary>
 /// <param name = "context">Current build context.</param>
 /// <param name = "resolverPolicyDestination">The <see cref = 'IPolicyList' /> to add any
 ///   generated resolver objects into.</param>
 /// <returns>Sequence of methods to call.</returns>
 public IEnumerable<SelectedMethod> SelectMethods(IBuilderContext context, IPolicyList resolverPolicyDestination)
 {
     foreach (Pair<MethodInfo, IEnumerable<InjectionParameterValue>> method in methods)
     {
         Type typeToBuild = context.BuildKey.Type;
         SelectedMethod selectedMethod;
         var typeReflector = new ReflectionHelper(method.First.DeclaringType);
         var methodReflector = new MethodReflectionHelper(method.First);
         if (!methodReflector.MethodHasOpenGenericParameters && !typeReflector.IsOpenGeneric)
         {
             selectedMethod = new SelectedMethod(method.First);
         }
         else
         {
             Type[] closedMethodParameterTypes =
                 methodReflector.GetClosedParameterTypes(typeToBuild.GetGenericArguments());
             selectedMethod = new SelectedMethod(
                 typeToBuild.GetMethod(method.First.Name, closedMethodParameterTypes));
         }
         SpecifiedMemberSelectorHelper.AddParameterResolvers(
             typeToBuild,
             resolverPolicyDestination,
             method.Second,
             selectedMethod);
         yield return selectedMethod;
     }
 }
开发者ID:Raconeisteron,项目名称:bakopanos,代码行数:34,代码来源:SpecifiedMethodsSelectorPolicy.cs


示例4: SelectProperties

        public IEnumerable<SelectedProperty> SelectProperties(IBuilderContext context, IPolicyList resolverPolicyDestination)
        {
            var t = context.BuildKey.Type;
             var propertyNames = new HashSet<string>();
             foreach (SelectedProperty prop in specifiedPropertiesPolicy.SelectProperties(context,resolverPolicyDestination))
             {
            if (!propertyNames.Contains(prop.Property.Name))
            {
               propertyNames.Add(prop.Property.Name);
               yield return prop;
            }
             }
             foreach (SelectedProperty prop in defaultProlicy.SelectProperties(context,resolverPolicyDestination))
             {
            if (!propertyNames.Contains(prop.Property.Name))
            {
               yield return prop;
            }
             }

             foreach (PropertyInfo prop in t.GetProperties(BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.Instance))
             {
            if (prop.GetIndexParameters().Length == 0 &&
               prop.CanWrite && !ShoudBeIgnored(prop) &&
               !propertyNames.Contains(prop.Name) &&
               !prop.PropertyType.IsValueType &&
               CanBeResolved(prop))
            {
               yield return CreateSelectedProperty(context, prop);
            }
             }
        }
开发者ID:kostaswonga,项目名称:NServiceBus,代码行数:32,代码来源:FullAutowirePropertySelectorPolicy.cs


示例5: AddPolicies

 /// <summary>
 /// Add policies to the <paramref name="policies"/> to configure the
 /// container to call this constructor with the appropriate parameter values.
 /// </summary>
 /// <param name="serviceType">Interface registered, ignored in this implementation.</param>
 /// <param name="implementationType">Type to register.</param>
 /// <param name="name">Name used to resolve the type object.</param>
 /// <param name="policies">Policy list to add policies to.</param>
 public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
 {
     ConstructorInfo ctor = this.FindConstructor(implementationType);
     policies.Set<IConstructorSelectorPolicy>(
         new SpecifiedConstructorSelectorPolicy(ctor, this.parameterValues.ToArray()),
         new NamedTypeBuildKey(implementationType, name));
 }
开发者ID:kangkot,项目名称:unity,代码行数:15,代码来源:InjectionConstructor.cs


示例6: RemoveResolvers

 /// <summary>
 /// Remove the currently tracked resolvers from the given policy list.
 /// </summary>
 /// <param name="policies">Policy list to remove the resolvers from.</param>
 public void RemoveResolvers(IPolicyList policies)
 {
     foreach(object key in keys)
     {
         policies.Clear<IDependencyResolverPolicy>(key);
     }
     keys.Clear();
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:12,代码来源:DependencyResolverTrackerPolicy.cs


示例7: AddPolicies

        /// <summary>
        /// Add policies to the <paramref name="policies"/> to configure the container with 
        /// an appropriate <see cref="IInstanceInterceptionPolicy"/>
        /// </summary>
        /// <param name="serviceType">Type of the interface being registered. This parameter is
        /// ignored by this class.</param>
        /// <param name="implementationType">Type to register.</param>
        /// <param name="name">Name used to resolve the type object.</param>
        /// <param name="policies">Policy list to add policies to.</param>
        public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
        {
            var key = new NamedTypeBuildKey(implementationType);
            policies.Set<IInstanceInterceptionPolicy>(new FixedInstanceInterceptionPolicy(Interceptor), key);

            var piabInjectionMember = new InterceptionBehavior<PolicyInjectionBehavior>();
            piabInjectionMember.AddPolicies(serviceType, implementationType, name, policies);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:17,代码来源:InstanceInterceptionPolicySettingInjectionMember.cs


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


示例9: AddPolicies

        /// <summary>
        /// Add policies to the <paramref name="policies"/> to configure the
        /// container to call this constructor with the appropriate parameter values.
        /// </summary>
        /// <param name="serviceType">Type of interface being registered. If no interface,
        /// this will be null. This parameter is ignored in this implementation.</param>
        /// <param name="implementationType">Type of concrete type being registered.</param>
        /// <param name="name">Name used to resolve the type object.</param>
        /// <param name="policies">Policy list to add policies to.</param>
        public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
        {
            Guard.ArgumentNotNull(implementationType, "implementationType");
            Guard.ArgumentNotNull(policies, "policies");

            var policy = new FactoryDelegateBuildPlanPolicy(this.factoryFunc);
            policies.Set<IBuildPlanPolicy>(policy,
                new NamedTypeBuildKey(implementationType, name));
        }
开发者ID:CFMITL,项目名称:unity,代码行数:18,代码来源:InjectionFactory.cs


示例10: AddPolicies

        /// <summary>
        /// Add policies to the <paramref name="policies"/> to configure the
        /// container to call this constructor with the appropriate parameter values.
        /// </summary>
        /// <param name="serviceType">Type of interface registered, ignored in this implementation.</param>
        /// <param name="implementationType">Type to register.</param>
        /// <param name="name">Name used to resolve the type object.</param>
        /// <param name="policies">Policy list to add policies to.</param>
        public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
        {
            MethodInfo methodInfo = this.FindMethod(implementationType);
            this.ValidateMethodCanBeInjected(methodInfo, implementationType);

            SpecifiedMethodsSelectorPolicy selector =
                GetSelectorPolicy(policies, implementationType, name);
            selector.AddMethodAndParameters(methodInfo, this.methodParameters);
        }
开发者ID:CFMITL,项目名称:unity,代码行数:17,代码来源:InjectionMethod.cs


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


示例12: BuilderContext

 /// <summary>
 /// Create a new <see cref="BuilderContext"/> using the explicitly provided
 /// values.
 /// </summary>
 /// <param name="chain">The <see cref="IStrategyChain"/> to use for this context.</param>
 /// <param name="lifetime">The <see cref="ILifetimeContainer"/> to use for this context.</param>
 /// <param name="persistentPolicies">The set of persistent policies to use for this context.</param>
 /// <param name="transientPolicies">The set of transient policies to use for this context. It is
 /// the caller's responsibility to ensure that the transient and persistent policies are properly
 /// combined.</param>
 /// <param name="buildKey">Build key for this context.</param>
 /// <param name="existing">Existing object to build up.</param>
 public BuilderContext(IStrategyChain chain, ILifetimeContainer lifetime, IPolicyList persistentPolicies, IPolicyList transientPolicies, NamedTypeBuildKey buildKey, object existing)
 {
     this.chain = chain;
     this.lifetime = lifetime;
     this.persistentPolicies = persistentPolicies;
     this.policies = transientPolicies;
     this.originalBuildKey = buildKey;
     this.BuildKey = buildKey;
     this.Existing = existing;
 }
开发者ID:theoju,项目名称:CleanCode,代码行数:22,代码来源:BuilderContext.cs


示例13: 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;
 }
开发者ID:CFMITL,项目名称:unity,代码行数:11,代码来源:InjectionMethod.cs


示例14: BuilderContext

 /// <summary>
 /// Create a new <see cref="BuilderContext"/> using the explicitly provided
 /// values.
 /// </summary>
 /// <param name="chain">The <see cref="IStrategyChain"/> to use for this context.</param>
 /// <param name="locator">The <see cref="IReadWriteLocator"/> to use for this context.</param>
 /// <param name="lifetime">The <see cref="ILifetimeContainer"/> to use for this context.</param>
 /// <param name="persistentPolicies">The set of persistent policies to use for this context.</param>
 /// <param name="transientPolicies">The set of transient policies to use for this context. It is
 /// the caller's responsibility to ensure that the transient and persistent policies are properly
 /// combined.</param>
 /// <param name="buildKey">Build key for this context.</param>
 /// <param name="existing">Existing object to build up.</param>
 public BuilderContext(IStrategyChain chain, IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList persistentPolicies, IPolicyList transientPolicies, object buildKey, object existing)
 {
     this.chain = chain;
     this.lifetime = lifetime;
     this.locator = locator;
     this.persistentPolicies = persistentPolicies;
     this.policies = transientPolicies;
     this.originalBuildKey = buildKey;
     this.buildKey = buildKey;
     this.existing = existing;
 }
开发者ID:shhyder,项目名称:application,代码行数:24,代码来源:BuilderContext.cs


示例15: AddParameterResolvers

 /// <summary>
 /// Add dependency resolvers to the policy set.
 /// </summary>
 /// <param name="policies">PolicyList to add the resolvers to.</param>
 /// <param name="parameterValues">Objects supplying the dependency resolvers.</param>
 /// <param name="result">Result object to store the keys in.</param>
 public static void AddParameterResolvers(IPolicyList policies, 
     IEnumerable<InjectionParameterValue> parameterValues, 
     SelectedMemberWithParameters result)
 {
     foreach(InjectionParameterValue parameterValue in parameterValues)
     {
         string key = Guid.NewGuid().ToString();
         policies.Set<IDependencyResolverPolicy>(parameterValue.GetResolverPolicy(), key);
         result.AddParameterKey(key);
     }
 }
开发者ID:shhyder,项目名称:application,代码行数:17,代码来源:SpecifiedMemberSelectorHelper.cs


示例16: 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;
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:18,代码来源:DefaultInterceptionBehavior.cs


示例17: AddPolicies

 /// <summary>
 /// Add policies to the <paramref name="policies"/> to configure the container to use the represented 
 /// <see cref="IInterceptionBehavior"/> for the supplied parameters.
 /// </summary>
 /// <param name="serviceType">Interface being registered.</param>
 /// <param name="implementationType">Type to register.</param>
 /// <param name="name">Name used to resolve the type object.</param>
 /// <param name="policies">Policy list to add policies to.</param>
 public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
 {
     if (this.explicitBehavior != null)
     {
         this.AddExplicitBehaviorPolicies(implementationType, name, policies);
     }
     else
     {
         this.AddKeyedPolicies(implementationType, name, policies);
     }
 }
开发者ID:kangkot,项目名称:unity,代码行数:19,代码来源:InterceptionBehaviorBase.cs


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


示例19: AddPolicies

 public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
 {
     if (serviceType == null)
         throw new ArgumentNullException(nameof(serviceType), "The service type cannot be null");
     if (implementationType == null)
         throw new ArgumentNullException(nameof(implementationType), "The implementation type cannot be null");
     policies.Set(
         typeof(ILazyProxyPolicy),
         new LazyProxyPolicy(serviceType, implementationType),
         new NamedTypeBuildKey(serviceType, name));
 }
开发者ID:thomaslevesque,项目名称:LazyProxy,代码行数:11,代码来源:InjectionLazyProxy.cs


示例20: AddPolicies

 /// <summary>
 /// Add policies to the <paramref name="policies"/> to configure the
 /// container to call this constructor with the appropriate parameter values.
 /// </summary>
 /// <param name="serviceType">Type of interface being registered. If no interface,
 /// this will be null.</param>
 /// <param name="implementationType">Type of concrete type being registered.</param>
 /// <param name="name">Name used to resolve the type object.</param>
 /// <param name="policies">Policy list to add policies to.</param>
 public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
 {
     if(IsInstanceInterceptor)
     {
         AddDefaultInstanceInterceptor(implementationType, policies);
     }
     else
     {
         AddDefaultTypeInterceptor(implementationType, policies);
     }
 }
开发者ID:shhyder,项目名称:MapApplication,代码行数:20,代码来源:DefaultInterceptor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPolygon类代码示例发布时间:2022-05-24
下一篇:
C# IPointList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap