Esempio n. 1
0
 /// <summary>
 /// 安装下一个类型
 /// </summary>
 protected override void nextCreate()
 {
     if (!Type.Type.IsInterface)
     {
         LeftArray <MemberExpression> members = default(LeftArray <MemberExpression>);
         nodeTypeNames.Clear();
         bool isMember = true;
         foreach (MemberIndex member in MemberIndex.GetMembers <AutoCSer.Net.RemoteExpression.MemberAttribute>(Type, AutoCSer.Metadata.MemberFilters.Instance, true, false))
         {
             if (!member.IsIgnore && member.CanGet)
             {
                 AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                 isMember &= addMember(ref members, new MemberExpression {
                     Attribute = attribute, Member = member, IntputParameters = member.IsField ? NullValue <ExpressionParameter> .Array : ExpressionParameter.Get(MethodParameter.Get(((PropertyInfo)member.Member).GetGetMethod(true), NullValue <Type> .Array))
                 });
             }
         }
         Members = members.ToArray();
         LeftArray <MethodExpression> methods = default(LeftArray <MethodExpression>);
         foreach (MethodIndex member in MethodIndex.GetMethods <AutoCSer.Net.RemoteExpression.MemberAttribute>(Type, AutoCSer.Metadata.MemberFilters.Instance, false, true, false))
         {
             if (!member.IsIgnore)
             {
                 AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                 isMember &= addMember(ref methods, new MethodExpression {
                     Attribute = attribute, Method = member, IntputParameters = ExpressionParameter.Get(member.Parameters)
                 });
             }
         }
         Methods = methods.ToArray();
         LeftArray <StaticMemberExpression> staticMembers = default(LeftArray <StaticMemberExpression>);
         foreach (MemberIndex member in MemberIndex.GetStaticMembers <AutoCSer.Net.RemoteExpression.MemberAttribute>(Type, AutoCSer.Metadata.MemberFilters.Static, true, false))
         {
             if (!member.IsIgnore && member.CanGet)
             {
                 AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                 isMember &= addMember(ref staticMembers, new StaticMemberExpression {
                     Attribute = attribute, Member = member, IntputParameters = NullValue <ExpressionParameter> .Array
                 });
             }
         }
         StaticMembers = staticMembers.ToArray();
         LeftArray <StaticMethodExpression> staticMethods = default(LeftArray <StaticMethodExpression>);
         foreach (MethodIndex member in MethodIndex.GetMethods <AutoCSer.Net.RemoteExpression.MemberAttribute>(Type, AutoCSer.Metadata.MemberFilters.Static, false, true, false))
         {
             if (!member.IsIgnore)
             {
                 AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                 isMember &= addMember(ref staticMethods, new StaticMethodExpression {
                     Attribute = attribute, Method = member, IntputParameters = ExpressionParameter.Get(member.Parameters)
                 });
             }
         }
         StaticMethods = staticMethods.ToArray();
         if (isMember && (Members.Length | Methods.Length | StaticMemberCount) != 0)
         {
             create(true);
         }
     }
 }
Esempio n. 2
0
                /// <summary>
                /// 表达式成员集合
                /// </summary>
                /// <param name="type"></param>
                /// <param name="memberNodeTypeName"></param>
                internal ExpressionMemberGroup(ExtensionType type, string memberNodeTypeName)
                {
                    this.type = type;
                    this.memberNodeTypeName = memberNodeTypeName;
                    LeftArray <Expression> members = new LeftArray <Expression>(0);

                    nodeTypeNames.Clear();
                    foreach (MemberIndex member in MemberIndex.GetMembers <AutoCSer.Net.RemoteExpression.MemberAttribute>(type, AutoCSer.Metadata.MemberFilters.Instance, true, false))
                    {
                        if (!member.IsIgnore && member.CanGet)
                        {
                            AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                            IsMember &= addMember(ref members, new Expression {
                                Attribute = attribute, Member = member, IntputParameters = member.IsField ? EmptyArray <ExpressionParameter> .Array : ExpressionParameter.Get(MethodParameter.Get(((PropertyInfo)member.Member).GetGetMethod(true), EmptyArray <Type> .Array))
                            });
                        }
                    }
                    foreach (MethodIndex member in MethodIndex.GetMethods <AutoCSer.Net.RemoteExpression.MemberAttribute>(type, AutoCSer.Metadata.MemberFilters.Instance, false, true, false))
                    {
                        if (!member.IsIgnore)
                        {
                            AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                            IsMember &= addMember(ref members, new Expression {
                                Attribute = attribute, Method = member, IntputParameters = ExpressionParameter.Get(member.Parameters)
                            });
                        }
                    }
                    Members = members.ToArray();
                    if (memberNodeTypeName == null)
                    {
                        LeftArray <StaticExpression> staticMembers = new LeftArray <StaticExpression>(0);
                        foreach (MemberIndex member in MemberIndex.GetStaticMembers <AutoCSer.Net.RemoteExpression.MemberAttribute>(type, AutoCSer.Metadata.MemberFilters.Static, true, false))
                        {
                            if (!member.IsIgnore && member.CanGet)
                            {
                                AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                                IsMember &= addMember(ref staticMembers, new StaticExpression {
                                    Attribute = attribute, Member = member, IntputParameters = EmptyArray <ExpressionParameter> .Array
                                });
                            }
                        }
                        foreach (MethodIndex member in MethodIndex.GetMethods <AutoCSer.Net.RemoteExpression.MemberAttribute>(type, AutoCSer.Metadata.MemberFilters.Static, false, true, false))
                        {
                            if (!member.IsIgnore)
                            {
                                AutoCSer.Net.RemoteExpression.MemberAttribute attribute = member.GetAttribute <AutoCSer.Net.RemoteExpression.MemberAttribute>(false);
                                IsMember &= addMember(ref staticMembers, new StaticExpression {
                                    Attribute = attribute, Method = member, IntputParameters = ExpressionParameter.Get(member.Parameters)
                                });
                            }
                        }
                        StaticMembers = staticMembers.ToArray();
                    }
                    else
                    {
                        StaticMembers = EmptyArray <StaticExpression> .Array;
                    }
                    if ((IsMember &= (Members.Length | StaticMembers.Length) != 0) && memberNodeTypeName == null)
                    {
                        foreach (Expression member in Members)
                        {
                            member.CheckGenericMemberGroup();
                        }
                        foreach (StaticExpression member in StaticMembers)
                        {
                            member.CheckGenericMemberGroup();
                        }
                    }
                }