EF6 support for ASP.NET WebForms EntityDataSource

Topics: General
Feb 28, 2013 at 8:42 PM
The EntityDataSource control in ASP.NET uses System.Data.Entity and exposes System.Data.Objects.ObjectContext. With all the EF "classic" stuff being pulled into the EntityFramework dll and the namespace change, is there a plan to create a new version of System.Web.Entity.dll that uses the new EF6 ObjectContext?

I have a hybrid MVC/WebForms project where WebForms part is using DynamicData that uses the ObjectContext from CodeFirst (using David Ebbo's DynamicData.EFCodeFirstProvider).

Could I run both side by side? How would I get the Edm model in the EF6 ObjectContext over to the EF5 ObjectContext?
Feb 28, 2013 at 9:07 PM
Hi Duncan,

We haven't yet decided whether or not to release a version of the Entity Data Source for EF6. Part of what will impact the final decision is the number of people that need this. So far you are the first person that we have heard from that is interested in having an Entity Data Source for EF6. We will also do some investigation into running side-by-side as you mention.

Feb 28, 2013 at 9:47 PM
Cheers Arthur.

If push came to shove, I could decompile/get the reference source to System.Web.Entity.dll and patch it myself :-)

Feb 28, 2013 at 10:54 PM
Hi Duncan,

Thanks for your feedback. Can you please create a suggestion in our UserVoice site. There other people can see your idea and vote for it they also want the same thing.

Feb 28, 2013 at 11:36 PM
Oct 25, 2013 at 12:13 AM
It seems strange that the EntityDataSource doesn't work with the Entity Framework 6. I suppose I don't know why it is never used. The Data Source objects provide a ton of functionality to various controls. Is there a different way to achieve the same results now?
Oct 25, 2013 at 4:44 AM
Hi kidsysco,

We are still figuring out some details but the current plan is to release a build of the EntityDataSource control that is adapted to work with EF6. In the meanwhile the recommended way to do databinding in Web Forms is Web Forms Model Binding.

Hope this helps,
Nov 5, 2013 at 10:11 PM
Hi Diego,

Although I wouldn't use an EntityDataSource in new (green field) development, I do have a legacy ASP.NET project that I'd like to upgrade to 4.5 and VS 2013. It would be far easier/safer/cheaper to move forward with an EDS control for EF6.

Rather than messing with old webforms, I could concentrate on implementing new functionality in EF6.
Nov 5, 2013 at 10:38 PM
Hi kjopc,

Sounds reasonable. I will update this thread as soon as we have news to share about the EntityDataSource build that works with EF6.

Nov 18, 2013 at 7:11 PM
Hi Diego,

Is there any targeted date for a release of the EntityDataSource build EF6 compatibable version?

I really need it !

Nov 22, 2013 at 2:49 PM
we need it! is possible know the date of this update? this is another strange thing of microsoft, release new version of EF without update components that use it :(
we are working with this instruments, we are not playing, neeed it
Dec 11, 2013 at 12:38 AM
divega wrote:
Hi kjopc,

Sounds reasonable. I will update this thread as soon as we have news to share about the EntityDataSource build that works with EF6.

Any progress to report on the EntityDataSource control?
Dec 17, 2013 at 3:45 AM
I have been waiting on an updated EntityDataSource control. The reason I'm using EntityDataSource is because filtering and paging are done in the SQL Server with this control. I need this because I have some large data sets (millions of rows). I'm using Telerik's RadGrid control. I think the same is true for the standard Microsoft control though. I would have liked to switch to the new strongly typed way of doing queries with IQuerable<T>. However, I don't necessarily want to return full entities. Also, RadGrid has built-in filtering controls which you get for free and if you use those with EntityDataSource the filtering happens in the database server. Also, if I remember correctly, there was a problem with the built-in sorting in RadGrid when using the new data binding methods (according to Telerik it was due to a limitation in the API that they were using from Microsoft). Long story short, the most efficient and easiest way to get things to work completely (built-in filtering, paging and sorting using Telerik's RadGrid) is using EntityDataSource. So, this is a blocker for me. I really hope that Microsoft releases an updated component. It would be pretty crazy if they didn't IMHO. It's pretty crazy that it wasn't already released with VS 2013, but, I guess maybe that is a result of the new quicker release cycle.
Dec 17, 2013 at 4:57 AM
It's worrisome that a control that is essential to upgrade many existing webform sites was dropped for the original EF6 release.

The absence of information here suggests that EntityDataSource simply isn't a priority.
Dec 22, 2013 at 3:24 AM
I've been using VS2013 since shortly after it was released. I only code in VB and frequently use ListView and GridView. I've been struggling with EF6 and its relationship to these controls without using EntityDataSource. Of course, there is a hack for using EF5 in VS2013 and therefore EntityDataSource - but, I prefer to move ahead with EF6 and the so-called model binding methods (selectmethod, updatemethod, etc). On one hand, I like the concept of using entities with linq in the VB code behind - it seems like a more logical way of providing data for the controls and responding to user actions.

The problem for me is the near total lack of documentation and examples for VB. The link mentioned above is nearly useless for a VB programmer. There is some VB download code that is almost impossible to get running. I've been putting together a set of examples for the 4 methods and some variations - like sorting when the select filters. Some issues could be solved with dynamic data - lots of luck with getting EF6-linq-VB documentation. I've spent a huge number of hours trashing about with trial and error to get some pretty simple things working. It seems to me that Microsoft is really missing the boat by not providing better documentation and examples. If not for Stack Overflow, and the author, Imar Spaanjaars, I would simply have given up.

It really makes me wonder if Microsoft is serious about continuing with VB? I could probably re-train in C# (I was a C programmer years ago) but I find VB to be far more productive for my needs.
Dec 22, 2013 at 3:55 AM
Edited Dec 22, 2013 at 3:56 AM
Hi Dave,

It's somewhat off-topic, but the reason you don't find many VB examples is because nobody inside MS uses VB except to make VB examples.

Like you, I was more comfortable with VB and have done major projects in the language. I learned C# for a contract (felt like I was all thumbs and used the Telerik code converter a lot!) and yet now feel clumsy in VB.

My advice is to accept the inevitable and make an effort to grasp C#. It seems to be the language of MS development and the future.

Besides, being able to understand a code snippet in either language is a great advantage.
Jan 10, 2014 at 3:58 PM
Hi Everybody,

It's quite incredible !?

This control is effectively great and it would be a so great regression if it's not supported !

For the moment, i keep running with EF5, with real hope to see these really necessary upgrade ...

Best regards
Jan 10, 2014 at 6:39 PM
We are planning to have a preview of a version of the EntityDataSource that works with EF6 out soon. I will update this thread when it is available.
Jan 17, 2014 at 2:43 PM
I certainly want to see the Dynamic Data Entities project type working again
Jan 30, 2014 at 1:02 PM
Edited Jan 30, 2014 at 1:02 PM
I really am looking forward to the new EntityDatasource control. Not being able to use it with the new Entity Framework 6 really is a hassle when maintening and improving existing application.

In the meantime, I'll try using the new Model Binding feature from ASP.NET 4.5 WebForms.

Let us now when this is available.

Best regards
Jan 31, 2014 at 3:05 PM
Mar 3, 2014 at 4:23 PM
I'have just tested the fresh 6.0.0 version : no SmartTag (the config is manual in source panel), but it seems to be working : Great !

With hope it will continie to be supported in future versions of EF ...

Thanks and best regards

Apr 29, 2014 at 11:19 PM
Edited Apr 29, 2014 at 11:22 PM
I am not sure if this is related to this thread, but I just created a simple EF6 project and am running into problems trying to get an ObjectContext out of a dbContext. I need to do this in order to open and close the database as I have been doing with EF5 as follows:

while (((IObjectContextAdapter)dbContext).ObjectContext.Connection.State.ToString() != "Open")

How can I do it? Alternately, is there a different recommended method to accomplish this now?

I am also using the ObjectContext to execute SQL. What is the recommended method to do this with EF6?

Apr 30, 2014 at 2:38 AM
Hi Manish,

I cannot see anything in your code snippets that wouldn't work with EF, but can I ask why you need to do this?

The preferred API to execute raw SQL in EF6 is dbContext.Database.ExecuteSqlCommand and dbContext.Database.SqlQuery, as well as dbContext.MySet.SqlQuery. But you can use their ObjectContext counterparts ExecuteStoreQuery and ExecuteStoreCommand if your application was built against the ObjectContext APIs.