Announcing preview of Dynamic Data provider and EntityDataSource control for Entity Framework 6

Announcing preview of Dynamic Data provider and EntityDataSource control for Entity Framework 6

Rate This
  • Comments 21

Today, we are pleased to announce an update to ASP.NET DynamicData and EntityDataSource control, so that they work with Entity Framework 6.

What’s in this preview

- DynamicData provider for Entity Framework 6

- EntityDataSource control for Entity Framework 6

How to install this preview

You can download this preview for ASP.NET DynamicData.EFProvider (http://www.nuget.org/packages/Microsoft.AspNet.DynamicData.EFProvider/) and EntityDataSource (http://www.nuget.org/packages/Microsoft.AspNet.EntityDataSource/) as preview NuGet packages from the NuGet gallery. You can install these pre-release packages through NuGet using the NuGet Package Manager Console, like this:

  • Install-Package Microsoft.AspNet.DynamicData.EFProvider -Version 6.0.0-alpha1 –Pre
  • Install-Package Microsoft.AspNet.EntityDataSource -Version 6.0.0-alpha1 –Pre

Getting started

Microsoft.AspNet.DynamicData.EFProvider

This package has a DynamicData EFProvider for EntityFramework 6. This provider can work with a Model (either Code First or Model First) which was created using Entity Framework 6. This package also installs the Page Templates, Entity Templates and Field Templates which are required for DynamicData. The templates have been updated to use Microsoft.AspNet.EntityDataSource control which we are also previewing today as well.

For more information on ASP.NET DynamicData please see http://msdn.microsoft.com/en-us/library/cc488545.aspx

Following are the steps for using this package in a ASP.NET DynamicData application:

    • Create a new ASP.NET Dynamic Data Entities Web Application
    • Add the Microsoft.AspNet.DynamicData.EFProvider NuGet package
    • This will do the following
      • Add a reference to the DynamicData EFProvider binary
      • Install the templates. If you are starting with a new project, then you can override the templates. If you have an existing application, then you should be careful when overriding the changes. The templates replace the EntityDataSource control which shipped in .NET with Microsoft.AspNet.EntityDataSource and also have a few bug fixes in the Many-Many field template so they work with EntityFramework 6.
    • Create your model using Entity Framework Code First or EF Designer.
    • Add the following code in RegisterRoutes in Global.asax.cs to register your EF Model:
Code Snippet
  1. DefaultModel.RegisterContext(
  2.     new Microsoft.AspNet.DynamicData.ModelProviders.EFDataModelProvider(() => newNorthwindEntities1()),
  3.     newContextConfiguration { ScaffoldAllTables = true });
  • Run the project
  • You would see all the tables listed on the Default page.

Microsoft.AspNet.EntityDataSource Control

This is an update to the EntityDataSource control which shipped in the .NET Framework. The EntityDataSource control has been updated to work with Entity Framework 6.

To use this control, please do the following

    • Create an ASP.NET application
    • Install the package Microsoft.AspNet.EntityDataSource
      • This package will
        • install the runtime binary for Microsoft.AspNet.EntityDataSource
        • Install the EntityFramework version 6 NuGet package
        • Add the following tag prefix in web.config
Code Snippet
  1. <pages>
  2.   <controls>
  3.     <addtagPrefix="ef"assembly="Microsoft.AspNet.EntityDataSource"namespace="Microsoft.AspNet.EntityDataSource" />
  4.   </controls>
  5. </pages>
  • Create a new Web Form page
  • Use the control as follows and bind it to any Databound control such as GridView, FormView etc.
  • Code Snippet
    1. <ef:EntityDataSourceID="GridDataSource"runat="server"EnableDelete="true"/>

Known Issues

  • The templates in Microsoft.AspNet.DynamicData.EFProvider are for C# only.
  • The templates in Microsoft.AspNet.DynamicData.EFProvider are for Web Application projects only and will not work for WebSites projects.

Give feedback

If you find any issues with this preview, please file issues at the EntityFramework CodePlex site https://entityframework.codeplex.com

Thank you for trying out the preview and helping us make it better.

Leave a Comment
  • Please add 8 and 5 and type the answer here:
  • Post
  • Is the new ASP.NET Identity going to be easy to integrate into the Dynamic Data project.

    Dynamic Data is nice, especially for admin tool, but how does one secure it?

  • So I upgraded to EF6, yay, from EF4 Object context... everything is finally good except at runtime the ef:EntityDataSource control is rendering this error: Unable to find the requested .Net Framework Data Provider.  It may not be installed.

    I'm running against Azure SQL Database... what might I have missed here? The markup example above is very limited, I just changed my old asp: controls to ef: and left the rest of the EntityDataSource markup intact.

  • I converted EF5 DD project with your guide, but it doesn't work

    Then i Put

    DefaultModel.RegisterContext(

               new Microsoft.AspNet.DynamicData.ModelProviders.EFDataModelProvider(() =>

                   RendicontazioneEntities()),

                   newContextConfiguration { ScaffoldAllTables = true });

    I received this errors

    Error 8 'RendicontazioneEntities' is a 'type' but is used like a 'variable'

    Before i Used

    DefaultModel.RegisterContext(() =>

           {

               return ((System.Data.Entity.Infrastructure.IObjectContextAdapter)new RendicontazioneEntities()).ObjectContext;

           }, new ContextConfiguration() { ScaffoldAllTables = true });

    Can you help me please? thanks

  • I just downloaded the released version of ASP.NET EntityDataSource 6.0.0 published 2/28/2014 and I get the following error when using it:

    "The provider did not return a ProviderManifest instance"

    If I edit the .edmx file and replace ProviderManifestToken="2012" with ProviderManifestToken="2008", then it works fine.

    Is that component compatible with SQL Server 2012?

  • @ F B, I think you will get better answered and tracked if you report this issue to entityframework.codeplex.com.

  • One instruction is obscure for me, as I am just learning .NET. What is meant by "bind it to any Databound control...". Would someone please leave a comment showing an example in context?

    •Create a new Web Form page

    •Use the control as follows and bind it to any Databound control such as GridView, FormView etc.

    1.<ef:EntityDataSourceID="GridDataSource"runat="server"EnableDelete="true"/>

Page 2 of 2 (21 items) 12