What are the pros and cons of using EntityDataSource vs ObjectDataSource in Entity Framework asp.net based apps?
Basically EntityDataSource is build to support Entity Framework entities for features like sorting, filtering, inserting, deleting etc... If you use the ObjectDataSource you will have to do this on your own.
One huge disadvantage of EDS controls that I just discovered the hard way, is that they want to update the database immediately and each such control has its own EF object context, its own database connection, and even after I wrote a handler to share a context, share a db connection and turn off all immediate inserting, updating and deleting, so that I could do the final SaveChanges()
at the end when the user hit the final "submit" button, the EDS control uses EF in such a fashion that it still fetches deleted records. and does not fetch inserted records. SO I am going to convert where I use EDS controls to use ODS controls instead and thus allow me to interject another object model in between my radgird views and EF in order to have the grid show inserted records and not show deleted records and be able to allow the user the delayed commit back to the database. As far as I can tell, there is no other way to have web grids use EDS controls and to delay this final commit as well as show inserted records or not show deleted records. I would love to be proven wrong on these facts.e
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With