I have a utility class that translates objects into DataTables and vice versa. We're having problems loading large amounts of data when converting from a DataTable to a List of Objects. We use a custom attribute to determine and relate column information. Here's the pseudocode:
For each row in the table
For each property in an object
For each attribute on that property
If the attribute is our column information attribute
Grab the data from the table and insert the value into the objects property
End
End
End
End
For DataTable results that have hundreds of rows, though, this process is taking minutes... and that's simply unacceptable in a web app.
So, my question is: Is there some easy way to translate a DataTable and a .NET (custom) data object back and forth that doesn't require a lot of reflection (which is probably where all the overhead is in this case)?
Edit: Turns out it was another issue within the data object itself. Still, I did optimize the loader a bit with the reflection calls, so thank you all.