Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any performance advantage to EntityDataSource over programmatic binding?

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

like image 867
Jason Avatar asked Feb 23 '23 11:02

Jason


2 Answers

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.

like image 187
Wiktor Zychla Avatar answered Feb 25 '23 00:02

Wiktor Zychla


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

like image 41
tdykstra Avatar answered Feb 25 '23 01:02

tdykstra