Using System.Reflection
#region Product
internal static Downmoon.Product.Framework.Components.Product LoadSingleProduct(IDataReader reader)
{
Downmoon.Product.Framework.Components.Product m_Product = new Downmoon.Product.Framework.Components.Product();
Type type = m_Product.GetType();
for (int i = 0; i < reader.FieldCount; i++)
{
if (!reader.IsDBNull(i))
{
try { type.InvokeMember(reader.GetName(i), BindingFlags.Default | BindingFlags.SetProperty, null, m_Product, new object[] { reader.GetValue(i) }); }
catch (MissingMemberException exception) { System.Diagnostics.Debug.WriteLine(exception.Message); }
}
}
return m_Product;
}
#endregion