ASP.net: Efficient ways to convert DataSets to GenericCollection (Of ObjectType)
- by jlrolin
I currently have a function that gets some data from the database and puts it into a dataset. The return type on my function is GenericCollection (Of CustomerDetails)
If I do this:
Dim dataset As DataSet = Read(strSQL.ToString) 'Gets Data from DB
What's the most efficient way to map the dataset results to an collection of objects. More importantly, since I'm using GenericCollection, is there a way to do this in which I can call a function from the ObjectType class (CustomerDetails) that would have a means to converting that specific object.
Or is there a way in which I can use a function that would handle all types?
Is there a way to do something like:
Return returnedResults.TransformDataSet(dataset)
In which returnedResults is an object collection Of CustomerDetails, or would it simply be easier to have TransformDataSet return an object collection Of CustomerDetails by itself?
Thanks for any help.