I have a business object let’s say a Customer. I have a DAL method which brings back a datatable of customers. I have a UI which has a grid which will display a list of customers.
My question is.. is it OK to bind the grid to the datatable, which means the UI will have a reference to System.Data or should the datatable be converted first to an IList and bind that to the grid? The conversion from dt to a list could be a performance hit and I don’t see what I would be gaining from using the list instead of going straight with the datatable. Plus I love the datatable visualizer!
What are real advantages of using list of objects instead of datatables of data?
The only real advantage to using a list of objects over a datatable besides architecture is the strongly typed properties you get (which you can get with typed datasets too). But if you’re databinding that doesn’t really matter much.
It is perfectly okay to bind to the datatable, and a lot of really good applications use that as their architecture. They will pull back datatables instead of objects from the DAL. I personally don’t do this, but there’s nothing wrong with it per se.