ASP.net: Efficient ways to convert DataSets to GenericCollection (Of ObjectType)

Posted by jlrolin on Stack Overflow See other posts from Stack Overflow or by jlrolin
Published on 2010-02-24T17:13:17Z Indexed on 2010/06/18 14:03 UTC
Read the original article Hit count: 161

Filed under:

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.

© Stack Overflow or respective owner

Related posts about ASP.NET