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 theDataProvider(orRepository) 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.