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); }
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)); }
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)); } }