Shaolinq.Persistence.DefaultTimeSpanSqlDataType.GetReadExpression C# (CSharp) Method

GetReadExpression() public method

public GetReadExpression ( Expression dataReader, int ordinal ) : Expression
dataReader System.Linq.Expressions.Expression
ordinal int
return System.Linq.Expressions.Expression
		public override Expression GetReadExpression(Expression dataReader, int ordinal)
		{
			if (Nullable.GetUnderlyingType(this.SupportedType) == null)
			{
				return Expression.Condition
				(
					Expression.Call(dataReader, IsDbNullMethod, Expression.Constant(ordinal)),
					Expression.Convert(Expression.Constant(this.SupportedType.GetDefaultValue()), this.SupportedType),
					Expression.New
					(
						timeSpanConstructor,
						Expression.Call(dataReader, getValueMethod, Expression.Constant(ordinal))
					)
				);
			}
			else
			{
				return Expression.Condition
				(
					Expression.Call(dataReader, IsDbNullMethod, Expression.Constant(ordinal)),
					Expression.Constant(null, this.SupportedType),
					Expression.New
					(
						nullableTimeSpanConstructor,
						Expression.New
						(
							timeSpanConstructor,
							Expression.Call(dataReader, getValueMethod, Expression.Constant(ordinal))
						)
					)
				);
			}
		}
	}