Currently, if we want to get a list of records from the database, our DAL returns a DataTable to our business layer, which then returns the same DataTable to our calling interface (in this case an asp.vb page).
However I don't believe we should be returning a DataTable from the BLL, I always thought it would be better to return a strongly typed collection based on the fields in the stored procedure e.g.
public Class MyCustomType
public customerId as int32
public name as string
end Class
public function GetCustomers() as Generic.ICollection(Of MyCustomType)
//call to DAL here
end function
Would the best way to achieve this be iterating over our DataTable, and for each DataRow, create a new MyCustomType object and add it to the collection, then return the collection?
Thanks.