public override Expression GetReadExpression(Expression dataReader, int ordinal)
{
if (this.UnderlyingType == null)
{
return Expression.Condition
(
Expression.Call(dataReader, IsDbNullMethod, Expression.Constant(ordinal)),
Expression.Convert(Expression.Constant(this.SupportedType.GetDefaultValue(), this.SupportedType), this.SupportedType),
Expression.New
(
GuidConstructor,
Expression.Call(dataReader, DataRecordMethods.GetStringMethod, Expression.Constant(ordinal))
)
);
}
else
{
return Expression.Condition
(
Expression.Call(dataReader, IsDbNullMethod, Expression.Constant(ordinal)),
Expression.Convert(Expression.Constant(null, typeof(Guid?)), this.SupportedType),
Expression.New
(
NullableGuidConstructor,
Expression.New
(
GuidConstructor,
Expression.Call(dataReader, DataRecordMethods.GetStringMethod, Expression.Constant(ordinal))
)
)
);
}
}
}