locked
How to configure EntityDataSource for Entity Framework v6 RRS feed

  • Question

  • This has been asked a few times but no answers have yet been provided.

    I am using EF6.1 in VS2013 to create a web forms app. I know I need to manually add the properties to the EntityDataSource, but have found no docs on how to do this. If I run my project without settings I get this message:

    The ObjectContext must be configured by 1) defining ContextTypeName, 2) defining both ConnectionString and DefaultContainerName, 3) defining ContextType, or 4) supplying it in the OnSelecting event.

    That gives some clues. I put it what I think to be the ContextTypeName and I get this error:

    Could not load type 'WebFrontEndTestDBContext'.

    Maybe I do not know what my ContextTypeName. How do I find out?

    So I tried to set the connection string, but it also wants a DefaultContainerName. I have no idea what that is or how to find out.

    In another post Rowan Miller says "We no longer recommend using the Entity Data Source for new projects." I cannot find what I am supposed to be doing instead.

    Monday, January 25, 2016 5:11 AM

Answers

All replies

  • EF 6 uses Dbcontext not ObjectContext.

    And maybe you need to start with a simple Windows form application using EF, but you should note that it is using Objectcontext in the tutorial, and you'll need to use DBcontext.

    VB version has all the pictures that the C# one of the tutorial has lost.

    http://www.vbforums.com/showthread.php?540421-Tutorial-An-Introduction-to-the-ADO-NET-Entity-Framework

    Monday, January 25, 2016 1:30 PM
  • Hi brad,

    By default, EntityDataSource only support ef5, you need to install a new component via NuGet for supporting ef6, and the following link about installing the new component for your reference.

    http://blogs.msdn.com/b/webdev/archive/2014/02/28/announcing-the-release-of-dynamic-data-provider-and-entitydatasource-control-for-entity-framework-6.aspx

    in addition, according to your description, it more related to asp.net, you could post your case on asp.net webform forum (link as below) for better support.

    http://forums.asp.net/18.aspx/1?Web+Forms

    I hope it’s helpful to you.

    Best regards,

    Cole Wu

    Wednesday, January 27, 2016 1:36 AM
  • Cole,

    Thanks, but yeah, I installed the EF6 EntityDataSource package when I first encountered the error, but it was the manual configuration of it that I could find absolutely no documentation on.

    I have moved on to other non-EF options. If the question has been asked several times with no answers, I assume it is not a viable path.

    - Brad

    Monday, February 1, 2016 5:15 PM
  • Cole,

    Thanks, but yeah, I installed the EF6 EntityDataSource package when I first encountered the error, but it was the manual configuration of it that I could find absolutely no documentation on.

    I have moved on to other non-EF options. If the question has been asked several times with no answers, I assume it is not a viable path.

    - Brad

    Getting ObjectContext from DbContext:

    http://www.entityframeworktutorial.net/EntityFramework4.3/dbcontext-vs-objectcontext.aspx

    Wednesday, February 3, 2016 1:24 PM