hello,
example with ImageUrl (if you have stored procedure that not retieve ImageUrl field for example you set exclude to true :
protected virtual CategoryDetails GetCategoryFromReader(IDataReader reader, bool exclude)
{
if(!exclude)
return new CategoryDetails(
(int)reader["CategoryID"],
(DateTime)reader["AddedDate"],
reader["AddedBy"].ToString(),
reader["Title"].ToString(),
(int)reader["Importance"],
reader["Description"].ToString(),
reader["ImageUrl"].ToString());
else
return new CategoryDetails(
(int)reader["CategoryID"],
(DateTime)reader["AddedDate"],
reader["AddedBy"].ToString(),
reader["Title"].ToString(),
(int)reader["Importance"],
reader["Description"].ToString(),
"";
}
protected virtual List<CategoryDetails> GetCategoryCollectionFromReader(IDataReader reader, bool exclude)
{
List<CategoryDetails> categories = new List<CategoryDetails>();
while (reader.Read())
categories.Add(GetCategoryFromReader(reader, exclude));
return categories;
cheers
|