views:

635

answers:

1

Hello, I'm trying to use Dynamic Data with a entity model that has Abstract class that are Derived by sub entities.

Whenever i run the website i get this error:

model.RegisterContext(typeof(QMSModel.QMSEntities), new ContextConfiguration() { ScaffoldAllTables = false });[KeyNotFoundException: The given key was not present in the dictionary.] System.ThrowHelper.ThrowKeyNotFoundException() +28 System.Collections.Generic.Dictionary2.get_Item(TKey key) +7452124 System.Web.DynamicData.ModelProviders.EFAssociationProvider..ctor(EFColumnProvider column, NavigationProperty navigationProperty) +336 System.Web.DynamicData.ModelProviders.EFColumnProvider.get_Association() +82 System.Web.DynamicData.MetaColumn.Create(MetaTable table, ColumnProvider columnProvider) +16 System.Web.DynamicData.MetaTable..ctor(MetaModel metaModel, TableProvider tableProvider, Boolean scaffoldAllTables, String nameOverride) +272 System.Web.DynamicData.MetaModel.RegisterContext(DataModelProvider dataModelProvider, ContextConfiguration configuration) +758 System.Web.DynamicData.MetaModel.RegisterContext(Func1 contextFactory, ContextConfiguration configuration) +359 System.Web.DynamicData.MetaModel.RegisterContext(Type contextType, ContextConfiguration configuration) +79 ASP.global_asax.RegisterRoutes(RouteCollection routes) in c:\Projects\DynamicDataWebsite\AdventureWebSite\Global.asax:19 ASP.global_asax.Application_Start(Object sender, EventArgs e) in c:\Projects\DynamicDataWebsite\AdventureWebSite\Global.asax:49

Does anyone have an idea?

+1  A: 

The short answer is that Dynamic Data is broken when your Entity Framework model contains inheritance of any kind. This is supposed to be fixed in DD 4.0 Preview 3, but I have not tested that.

My overall impression is that the Dynamic Data support for the Entity Framework and ASP.NET MVC is still, to put it charitably, a work in progress.

Craig Stuntz