Esempio n. 1
0
        public override MemberInfo FromNode([Optional] Container container)
        {
            var constructorParamNames = Parameters.Select(e => e.Name);
            var constructorParamTypes = Parameters.Select(e => e.ParameterType.FromNode());

            var restoredType = Arguments != null?DeclaringType.FromNode().MakeGenericType(Arguments.Select(e => e.FromNode()).ToArray()) : DeclaringType.FromNode();


            var constructor = restoredType.GetConstructors().Where(e => e.GetParameters().Select(f => f.Name).OrderBy(x => x).SequenceEqual(constructorParamNames.OrderBy(y => y)) &&
                                                                   e.GetParameters().Select(f => f.ParameterType).OrderBy(x => x).SequenceEqual(constructorParamTypes.OrderBy(y => y))).Single(e => e.Name == Name);

            return(constructor);
        }
Esempio n. 2
0
        public override MemberInfo FromNode([Optional] Container container)
        {
            var concreteMethodInfo = DeclaringType.FromNode().GetMethods().Where(e => e.Name == Name).FirstOrDefault();

            return(IsGenericMethod ? concreteMethodInfo.MakeGenericMethod(GenericArguments.Select(e => e.FromNode()).ToArray()) : concreteMethodInfo);
        }
        public override ICollection <Type> GetKnownTypes([Optional] Container container)
        {
            Console.WriteLine("Member Info Node KnownType");

            return(new Type [] { DeclaringType?.FromNode(), MemberType.GetType(), this.GetType(), Name?.GetType() });
        }
Esempio n. 4
0
 public override MemberInfo FromNode([Optional] Container container)
 {
     return(DeclaringType.FromNode().GetProperties().Single(e => e.PropertyType == PropertyType.FromNode() && e.Name == Name));
 }
Esempio n. 5
0
 public override MemberInfo FromNode([Optional] Container container)
 {
     return(DeclaringType.FromNode().GetFields().Single(e => e.FieldType == FieldType.FromNode() && e.Name == Name));
 }