InfoQ Homepage News DynamicData and EntityDataSource Updated with Entity Framework 6 Support

DynamicData and EntityDataSource Updated with Entity Framework 6 Support


Microsoft has added Entity Framework 6 support for DynamicData and EntityDataSource controls in addition to updated templates which make use of Microsoft.AspNet.EntityDataSource. The DynamicData package works either with code first or model first created using Entity Framework 6, which also installs the required page, entity and field templates.

In order to use DynamicData control, you should create a new ASP.NET Dynamic Data entities web application and add the Microsoft.AspNet.DynamicData.EFProvider NuGet package which will ultimately add a reference to the DynamicData EFProvider binary and installs the required templates.

You should then create model using EF code first or designer and add the below code in Global.asax.cs file, which will register your Entity Framework model.

new Microsoft.AspNet.DynamicData.ModelProviders.EFDataModelProvider(() => newNorthwindEntities1()),
newContextConfiguration { ScaffoldAllTables = true });

On the other hand, Microsoft.AspNet.EntityDataSource package will install the runtime binary and EntityFramework version 6 NuGet package. You should also add the following tag prefix in web.config file as mentioned below

namespace="Microsoft.AspNet.EntityDataSource" />

Finally, you should create a new web form page and bind the EntityDataSource control to either GridView or FormView using the code below


The installed templates replace the default EntityDataSource control with Microsoft.AspNet.EntityDataSource package. It also includes few bug fixes which resolve few issues associated with Many-Many field template. However, the templates included with Microsoft.AspNet.DynamicData.EFProvider are oriented for C# and Web Application projects and will not work with WebSites projects.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.