Esempio n. 1
0
 public ComposedProviderInfo(ProviderValueSource existing, ProviderValueSource item)
     : base(item.ProviderType, existing.Name)
 {
     _items = new List <ProviderValueSource> {
         existing, item
     };
 }
 void AppendResult(ProviderValueSource item)
 {
     lock (_valueSources) {
         ProviderValueSource existing;
         var member = item.Member;
         if (_valueSources.TryGetValue(member, out existing))
         {
             _valueSources[member] = existing.AppendOne(item);
         }
         else
         {
             _valueSources[member] = item;
         }
     }
 }
Esempio n. 3
0
        internal static int MatchMemberCriteria(ProviderValueSource source, object criteria)
        {
            if (criteria == null)
            {
                return(0);
            }
            var memberInfo = criteria as MemberInfo;

            if (memberInfo != null)
            {
                return(MemberCriteria(memberInfo, source));
            }
            var assembly = criteria as Assembly;

            if (assembly != null)
            {
                return(AssemblyCriteria(assembly, source));
            }

            var cpp = Properties.FromValue(criteria);

            int result = 0;

            // Match member and assembly
            var asm = criteria as Assembly ?? cpp.GetProperty("Assembly", (Assembly)null);
            var mem = criteria as MemberInfo ?? cpp.GetProperty("Member", (MemberInfo)null);

            if (asm != null)
            {
                result += AssemblyCriteria(asm, source);
            }
            if (mem != null)
            {
                result += MemberCriteria(mem, source);
            }

            return(result);
        }
Esempio n. 4
0
 public override ProviderValueSource AppendOne(ProviderValueSource item)
 {
     _items.Add(item);
     return(this);
 }
Esempio n. 5
0
 public virtual ProviderValueSource AppendOne(ProviderValueSource item)
 {
     return(new ComposedProviderInfo(this, item));
 }