Esempio n. 1
0
 public RuntimeMember Find(MemberSpecification specification, Func<KeyValuePair<string, Accessor>, bool> filter) {
     foreach (KeyValuePair<string, Accessor> accessor in accessors) {
         if (!filter(accessor)) continue;
         if (specification.IsSetter) return new SetterMember(accessor.Value);
         if (specification.IsGetter) return new GetterMember(accessor.Value);
     }
     throw new ArgumentException(string.Format("Missing member '{0}'", specification));
 }
Esempio n. 2
0
 public static RuntimeMember GetDirectInstance(object instance, MemberSpecification specification)
 {
     foreach (var member in FindDirectInstance(instance, specification).Value)
     {
         return(member);
     }
     throw specification.MemberMissingException(instance.GetType());
 }
Esempio n. 3
0
 public static RuntimeMemberFactory MakeFactory(MemberSpecification specification, MemberInfo memberInfo) {
     switch (memberInfo.MemberType) {
         case MemberTypes.Method:
             return new MethodMemberFactory(memberInfo, specification);
         case MemberTypes.Field:
             return new FieldMemberFactory(memberInfo);
         case MemberTypes.Property:
             return new PropertyMemberFactory(memberInfo);
         case MemberTypes.Constructor:
             return new ConstructorMemberFactory(memberInfo);
         default:
             return new UnsupportedMemberFactory(memberInfo);
     }
 }
Esempio n. 4
0
        public static RuntimeMemberFactory MakeFactory(MemberSpecification specification, MemberInfo memberInfo)
        {
            switch (memberInfo.MemberType)
            {
            case MemberTypes.Method:
                return(new MethodMemberFactory(memberInfo, specification));

            case MemberTypes.Field:
                return(new FieldMemberFactory(memberInfo));

            case MemberTypes.Property:
                return(new PropertyMemberFactory(memberInfo));

            case MemberTypes.Constructor:
                return(new ConstructorMemberFactory(memberInfo));

            default:
                return(new UnsupportedMemberFactory(memberInfo));
            }
        }
Esempio n. 5
0
 public override bool Matches(MemberSpecification specification)
 {
     return(false);
 }
Esempio n. 6
0
 public static RuntimeMember FindInstance(Func <TypedValue, MemberQuery, TypedValue> finder, object instance, MemberSpecification specification)
 {
     return(new MemberQuery(specification).Using(finder).Find(instance));
 }
Esempio n. 7
0
        public RuntimeMember Find(MemberSpecification specification) {
	        return columnAccessors.Find(specification, accessor => specification.MatchesIdentifierName(accessor.Key));
        }
Esempio n. 8
0
 public override bool Matches(MemberSpecification specification)
 {
     return(Info.IsGenericMethod
         ? specification.MatchesBaseName(info.Name)
         : base.Matches(specification));
 }
Esempio n. 9
0
 public static Maybe<RuntimeMember> FindDirectInstance(object instance, MemberSpecification specification) {
     return new MemberQuery(specification).FindMember(instance);
 }
Esempio n. 10
0
 public static RuntimeMember FindInstance(Func<TypedValue, MemberQuery, TypedValue> finder, object instance, MemberSpecification specification) {
     return new MemberQuery(specification).Using(finder).Find(instance);
 }
Esempio n. 11
0
	    public RuntimeMember Find(MemberSpecification specification) {
	        return columnAccessors.Find(specification, accessor => {
	            var accessorName = accessor.Key.EndsWith("=")
	                                      ? accessor.Key.Substring(0, accessor.Key.Length - 1)
	                                      : accessor.Key;
	            if (!specification.MatchesIdentifierName(accessorName)) return false;
	            if (currentHeader != null && currentHeader.Text.EndsWith("=") && !accessor.Key.EndsWith("=")) return false;
	            if (currentHeader != null && !currentHeader.Text.EndsWith("=") && accessor.Key.EndsWith("=")) return false;
	            return true;
	        });
	    }
Esempio n. 12
0
 public override bool Matches(MemberSpecification specification) { return false; }
Esempio n. 13
0
 public override bool Matches(MemberSpecification specification) {
     return Info.IsGenericMethod
         ? specification.MatchesBaseName(info.Name)
         : base.Matches(specification);
 }
Esempio n. 14
0
 public MethodMemberFactory(MemberInfo info, MemberSpecification specification) : base(info) {
     this.specification = specification;
 }
Esempio n. 15
0
 public virtual bool Matches(MemberSpecification specification) {
     return specification.MatchesGetSetName(info.Name);
 }
Esempio n. 16
0
 public virtual bool Matches(MemberSpecification specification)
 {
     return(specification.MatchesGetSetName(info.Name));
 }
Esempio n. 17
0
 public MethodMemberFactory(MemberInfo info, MemberSpecification specification) : base(info)
 {
     this.specification = specification;
 }
Esempio n. 18
0
 public static RuntimeMember GetDirectInstance(object instance, MemberSpecification specification) {
     foreach (var member in FindDirectInstance(instance, specification).Value) {
         return member;
     }
     throw specification.MemberMissingException(instance.GetType());
 }
Esempio n. 19
0
 public BasicMemberMatcher(object instance, MemberSpecification specification) {
     this.instance = instance;
     this.specification = specification;
 }
Esempio n. 20
0
 public MemberQuery(MemberSpecification specification) {
     this.specification = specification;
     flags = BindingFlags.Instance | BindingFlags.Static;
     finder = FindMember;
 }
Esempio n. 21
0
 public BasicMemberMatcher(object instance, MemberSpecification specification)
 {
     this.instance      = instance;
     this.specification = specification;
 }
Esempio n. 22
0
 public IndexerMemberMatcher(object instance, MemberSpecification specification) {
     this.specification = specification;
     this.instance = instance;
 }
Esempio n. 23
0
 public static Maybe <RuntimeMember> FindDirectInstance(object instance, MemberSpecification specification)
 {
     return(new MemberQuery(specification).FindMember(instance));
 }
Esempio n. 24
0
 public IndexerMemberMatcher(object instance, MemberSpecification specification)
 {
     this.specification = specification;
     this.instance      = instance;
 }
Esempio n. 25
0
 public MemberQuery(MemberSpecification specification)
 {
     this.specification = specification;
     flags  = BindingFlags.Instance | BindingFlags.Static;
     finder = FindMember;
 }
Esempio n. 26
0
 public RuntimeMember Find(MemberSpecification specification) {
     Assert.IsTrue(specification.MatchesIdentifierName("dynamic"));
     return new QueryableMember("dynamic");
 }