2013-07-19 03:47:55 +00:00
|
|
|
|
using System.Data.Common;
|
2013-03-30 21:56:34 +00:00
|
|
|
|
|
|
|
|
|
namespace Marr.Data
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This class contains public extension methods.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class ExtensionMethods
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a value from a DbDataReader by using the column name;
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static T GetValue<T>(this DbDataReader reader, string columnName)
|
|
|
|
|
{
|
|
|
|
|
int ordinal = reader.GetOrdinal(columnName);
|
|
|
|
|
return (T)reader.GetValue(ordinal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|