动态数据和实体框架的问题

时间:2009-04-07 09:06:19

标签: c# .net entity-framework dynamic-data

我正在尝试将动态数据用于具有由子实体派生的Abstract类的实体模型。

每当我运行网站时,我都会收到此错误:

model.RegisterContext(typeof(QMSModel.QMSEntities),new ContextConfiguration(){ScaffoldAllTables = false}); [KeyNotFoundException:给定的密钥不存在于字典中。] System.ThrowHelper.ThrowKeyNotFoundException()+ 28 System。 Collections.Generic.Dictionary 2.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(Func 1 contextFactory,ContextConfiguration配置)+359 System.Web.DynamicData.MetaModel.RegisterContext(类型contextType,ContextConfiguration配置)+79 ASP.global_asax.RegisterRoutes(RouteCollection路由)在c:\ Projects中\ DynamicDataWebsite \ AdventureWebSite \ Global.asax:19 ASP.global_asax.Application_Start(Object sender,EventArgs e)位于c:\ Projects \ DynamicDataWebsite \ AdventureWebSite \ Global.asax:49

有没有人有想法?

1 个答案:

答案 0 :(得分:1)

简短的回答是Dynamic Data is broken when your Entity Framework model contains inheritance of any kind。这应该是fixed in DD 4.0 Preview 3,但我没有测试过。

我的总体印象是,实体框架和ASP.NET MVC的动态数据支持仍然是慈善的,正在进行的工作。