Beispiel #1
0
        /// <summary>
        /// Registers the expression as returned column
        /// </summary>
        /// <param name="columnType"></param>
        /// <param name="valueIndex"></param>
        /// <param name="dataRecordParameter"></param>
        /// <param name="mappingContextParameter"></param>
        /// <returns></returns>
        protected virtual Expression GetOutputValueReader(Type columnType, int valueIndex, ParameterExpression dataRecordParameter,
                                                          ParameterExpression mappingContextParameter)
        {
            var        propertyReaderLambda = DataRecordReader.GetPropertyReader(columnType);
            Expression invoke = new ParameterBinder().BindParams(propertyReaderLambda,
                                                                 dataRecordParameter, mappingContextParameter, Expression.Constant(valueIndex));

            if (!columnType.IsNullable())
            {
                invoke = Expression.Convert(invoke, columnType);
            }
            return(invoke);
        }
 /// <summary>
 /// Registers the expression as returned column
 /// </summary>
 /// <param name="columnType"></param>
 /// <param name="valueIndex"></param>
 /// <param name="dataRecordParameter"></param>
 /// <param name="mappingContextParameter"></param>
 /// <returns></returns>
 protected virtual Expression GetOutputValueReader(Type columnType, int valueIndex, ParameterExpression dataRecordParameter,
                                                   ParameterExpression mappingContextParameter)
 {
     var propertyReaderLambda = DataRecordReader.GetPropertyReader(columnType);
     Expression invoke = new ParameterBinder().BindParams(propertyReaderLambda,
         dataRecordParameter, mappingContextParameter, Expression.Constant(valueIndex));
     if (!columnType.IsNullable())
         invoke = Expression.Convert(invoke, columnType);
     return invoke;
 }