コード例 #1
0
 public static CodeExpression GetInitExpression(this ColumnInfo columnInfo)
 {
     if (columnInfo.DataType != typeof(string).GetTypeName())
     {
         return(new CodeCastExpression(columnInfo.GetCodeType(CodeType.None), new CodePrimitiveExpression(0)));
     }
     return(null);
 }
コード例 #2
0
        public static CodeExpression GetGetValueMethodExpression(this ColumnInfo columnInfo)
        {
            var row            = new CodeVariableReferenceExpression("row");
            var getValue       = new CodeMethodReferenceExpression(row, GetMethodName(columnInfo));
            var columnName     = new CodePrimitiveExpression(columnInfo.Name);
            var getValueInvoke = new CodeMethodInvokeExpression(getValue, columnName);

            if (columnInfo.IsCustomType() == false)
            {
                return(getValueInvoke);
            }

            return(new CodeCastExpression(columnInfo.GetCodeType(CodeType.None), getValueInvoke));
        }
コード例 #3
0
        public static CodeExpression GetGetValueMethodExpression(this ColumnInfo columnInfo, int index, bool isDevmode)
        {
            if (isDevmode == true)
            {
                return(GetGetValueMethodExpression(columnInfo));
            }
            else
            {
                var row            = new CodeVariableReferenceExpression("row");
                var getValue       = new CodeMethodReferenceExpression(row, GetMethodName(columnInfo));
                var indexVar       = new CodePrimitiveExpression(index);
                var getValueInvoke = new CodeMethodInvokeExpression(getValue, indexVar);

                if (columnInfo.IsCustomType() == false)
                {
                    return(getValueInvoke);
                }

                return(new CodeCastExpression(columnInfo.GetCodeType(CodeType.None), getValueInvoke));
            }
        }