Register ObjectContext in EF6 - Dynamic Data RRS feed

  • Question

  • User-1131120020 posted

    Hi, We have recently upgraded our projects from EF 4.3 to EF 6. All seems to be fine except Dynamic Data project. EF model entities are used ObjectContext (not DBContext). I followed the steps you mentioned in this page and also referred the below url.


    Im getting error 'cannot implicitly convert type 'MyEntities' to system.data.entity.dbcontext' in the below line which is in Global.asax.

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

    I know system not allowing to convert from ObjectContext to DBContext. Do you have any suggestions to register ObjectContext Entities?

    I'm getting "The context type 'MyEntities' is not supported" error if I try the below one:


                 () =>


                     var context = ((IObjectContextAdapter)new MyEntities()).ObjectContext;

                     return context;


                 new ContextConfiguration() { ScaffoldAllTables = true });


    Wednesday, June 17, 2015 5:32 PM

All replies