-
Notifications
You must be signed in to change notification settings - Fork 0
MySql.Data
Benn Benson edited this page Jan 14, 2019
·
1 revision
public static class MySqlExtensions
{
private static readonly ValueExtractor _extractor = ValueExtractor.Create(config =>
{
config.UseNullTester(obj => obj is DBNull);
config.UseConverter(ExtractionConverters.DualTypeConverterWithFallbackImpl);
});
public static T Column<T>(this MySqlDataReader reader, int i)
{
if (reader is null)
throw new ArgumentNullException(nameof(reader));
return UnboxT<T>.Unbox(reader.GetValue(i));
}
public static T Column<T>(this MySqlDataReader reader, string name)
{
if (reader is null)
throw new ArgumentNullException(nameof(reader));
return UnboxT<T>.Unbox(reader.GetValue(reader.GetOrdinal(name)));
}
public static T GetValue<T>(this MySqlParameter parameter)
{
if (parameter is null)
throw new ArgumentNullException(nameof(parameter));
return UnboxT<T>.Unbox(parameter.Value);
}
}