예제 #1
0
 /// <summary>
 /// if开始代码段
 /// </summary>
 /// <param name="type">成员类型</param>
 /// <param name="name">成员路径名称</param>
 /// <param name="ifName">if临时变量名称</param>
 protected void ifStart(memberType type, string name, string ifName)
 {
     if (type.IsStruct || type.Type.IsEnum)
     {
         if (type.IsBool)
         {
             code.Append(@"
             if (", name, ")");
         }
         else if (type.IsAjaxToString)
         {
             code.Append(@"
             if (", name, " != 0)");
         }
     }
     else
     {
         code.Append(@"
             if (", name, " != null)");
     }
     code.Append(@"
             {");
     if (ifName != null)
     {
         code.Append(@"
                 ", ifName, " = true;");
     }
 }
예제 #2
0
 /// <summary>
 /// 成员信息
 /// </summary>
 /// <param name="member">属性</param>
 /// <param name="filter">选择类型</param>
 private memberInfo(PropertyInfo member, memberFilter filter)
     : this((MemberInfo)member, filter)
 {
     MemberType = member.PropertyType;
     CanSet     = member.CanWrite;
     CanGet     = member.CanRead;
 }
예제 #3
0
        /// <summary>
        /// 参数信息
        /// </summary>
        /// <param name="parameter">参数信息</param>
        /// <param name="index">参数索引位置</param>
        /// <param name="isLast">是否最后一个参数</param>
        private parameterInfo(ParameterInfo parameter, int index, bool isLast)
        {
            Parameter      = parameter;
            ParameterIndex = index;
            Type parameterType = parameter.ParameterType;

            if (parameterType.IsByRef)
            {
                if (parameter.IsOut)
                {
                    IsOut = true;
                }
                else
                {
                    IsRef = true;
                }
                ParameterType = parameterType.GetElementType();
            }
            else
            {
                ParameterType = parameterType;
            }
            ParameterName     = Parameter.Name;
            ParameterJoinName = isLast ? ParameterName : (ParameterName + ", ");
        }
예제 #4
0
 /// <summary>
 /// 成员信息
 /// </summary>
 /// <param name="type">成员类型</param>
 /// <param name="name">成员名称</param>
 /// <param name="index">成员编号</param>
 public memberInfo(memberType type, string name, int index)
 {
     MemberType  = type;
     MemberName  = name;
     MemberIndex = index;
     IsField     = CanSet = CanSet = true;
     Filter      = memberFilter.PublicInstance;
 }
예제 #5
0
 /// <summary>
 /// 成员方法
 /// </summary>
 /// <param name="method">成员方法信息</param>
 /// <param name="filter">选择类型</param>
 public methodInfo(MethodInfo method, memberFilter filter)
     : base(method, filter)
 {
     Method            = method;
     ReturnType        = Method.ReturnType;
     Parameters        = parameterInfo.Get(method);
     OutputParameters  = Parameters.getFindArray(value => value.Parameter.IsOut || value.Parameter.ParameterType.IsByRef);
     GenericParameters = method.GetGenericArguments().getArray(value => (memberType)value);
 }
예제 #6
0
 /// <summary>
 /// 成员信息
 /// </summary>
 /// <param name="member">成员信息</param>
 /// <param name="filter">选择类型</param>
 protected memberInfo(MemberInfo member, memberFilter filter)
 {
     Member     = member;
     MemberName = member.Name;
     Filter     = filter;
     IsIgnore   = member.customAttributes <ignore>(true).Any(value => value.IsIgnore);
     if (CanGet && CanSet)
     {
         sqlMember sqlMember = member.customAttribute <sqlMember>(true);
         if (sqlMember != null && sqlMember.SqlType != null)
         {
             MemberType = new memberType(MemberType, sqlMember.SqlType);
         }
     }
 }
예제 #7
0
        /// <summary>
        /// 成员信息
        /// </summary>
        /// <param name="member">字段</param>
        /// <param name="filter">选择类型</param>
        private memberInfo(FieldInfo member, memberFilter filter)
            : this((MemberInfo)member, filter)
        {
            IsField = CanGet = true;
            CanSet  = !member.IsInitOnly;
            sqlMember sqlMember = member.customAttribute <sqlMember>(true);

            if (sqlMember == null || sqlMember.SqlType == null)
            {
                MemberType = member.FieldType;
            }
            else
            {
                MemberType = new memberType(member.FieldType, sqlMember.SqlType);
            }
        }
예제 #8
0
 /// <summary>
 /// 参数信息
 /// </summary>
 /// <param name="parameter">参数信息</param>
 /// <param name="index">参数索引位置</param>
 /// <param name="isLast">是否最后一个参数</param>
 private parameterInfo(ParameterInfo parameter, int index, bool isLast)
 {
     Parameter = parameter;
     ParameterIndex = index;
     Type parameterType = parameter.ParameterType;
     if (parameterType.IsByRef)
     {
         if (parameter.IsOut) IsOut = true;
         else IsRef = true;
         ParameterType = parameterType.GetElementType();
     }
     else ParameterType = parameterType;
     ParameterName = Parameter.Name;
     ParameterJoinName = isLast ? ParameterName : (ParameterName + ", ");
 }