I'm working on a heavily data driven ASP.NET web forms application. We're using the Entity Framework 4.1 and I'm normally used to going around databinding all of my controls in the code behind. I've been coming across a lot of examples using the EntityDataSource ASP.NET control and am wondering if there is any advantage to using this control as opposed to binding the data on the code behind?
Thanks, J
I always considered "specialized" data sources risky and against properly layered applications. EntityDataSource, SqlDataSource, LinqDataSource, name it, you provide low-level access details in your declarative code. It feels great for a demo website but could potentially raise severe issues in a large one.
Have you instead considered using the ObjectDataSource
? It could provide the best of the two - you provide a clean, declarative binding so there's no binding code required yet the DataProvider
(or Repository
) class which ultimately provides the data has to be written in C#. From such class you can use any data access technology, EF, Linq, SQL, anything.
See the discussion of EntityDataSource vs. ObjectDataSource in
http://www.asp.net/entity-framework/tutorials/using-the-entity-framework-and-the-objectdatasource-control,-part-1-getting-started
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