Beispiel #1
0
 private static Expression BuildReadRowCaseGetValue(ParameterExpression dbDataReader, ParameterExpression i, DbDataReaderMapperItem item)
 {
     return(
         item.DbDataReader_GetValue_MethodInfo == DbDataReaderDefinitions.GetValue || item.IsValueTypeNullable || item.IsValueTypeEnum ?
         (Expression)Expression.Convert(
             Expression.Call(dbDataReader, item.DbDataReader_GetValue_MethodInfo, i),
             item.ItemType
             ) :
         (Expression)Expression.Call(dbDataReader, item.DbDataReader_GetValue_MethodInfo, i)
         );
 }
Beispiel #2
0
 private static Expression BuildReadRowCase(ParameterExpression dbDataReader, ParameterExpression i, ParameterExpression obj, ParameterExpression allowDBNullList, DbDataReaderMapperItem item)
 {
     return(Expression.IfThenElse(
                Expression.AndAlso(
                    Expression.ArrayAccess(allowDBNullList, i),
                    Call(dbDataReader, DbDataReaderDefinitions.IsDBNull, i)
                    ),
                Expression.Empty()
                ,
                item is DbDataReaderMapperProperty dataReaderMapperProperty ?
                BuildReadRowCaseSetValue(dbDataReader, i, obj, dataReaderMapperProperty) :
                BuildReadRowCaseSetValue(dbDataReader, i, obj, (DbDataReaderMapperField)item)
                ));;
 }