不支持上下文“System.Data.Entity.Core.Objects.ObjectContext”的EF6类型 [英] EF6 Type of context 'System.Data.Entity.Core.Objects.ObjectContext' is not supported
本文介绍了不支持上下文“System.Data.Entity.Core.Objects.ObjectContext”的EF6类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Visual Studio 2013与ADO.NET实体数据模型(EF6)的新项目创建。
I have a new project created using Visual Studio 2013 with an ADO.NET Entity Data Model (EF6).
现在我必须使用一些动态数据功能(像访问元表对象),所以我添加以下代码:
Now I have to use some Dynamic Data function (like access to MetaTable object), so I add this code:
MetaModel model = new MetaModel();
model.RegisterContext(() =>
{
return ((System.Data.Entity.Infrastructure.IObjectContextAdapter)new KiwiJuiceEntities()).ObjectContext;
}, new ContextConfiguration() { ScaffoldAllTables = true });
但我得到这个错误:
but I've got this error:
Type of context 'System.Data.Entity.Core.Objects.ObjectContext' is not supported
请注意,该项目已引用更新到EF6(system.data.entity.core)
Note that the project have the reference updated to EF6 (system.data.entity.core)
推荐答案
动态数据提供商和EntityDataSource控件的EF6的新的预览已被释放。请检查了这一点,它为我工作。
A new preview of Dynamic Data Provider and EntityDataSource control for EF6 has been released. Please check this out, it worked for me.
要注册供应商:
MetaModel model = new MetaModel();
model.RegisterContext(
new Microsoft.AspNet.DynamicData.ModelProviders.EFDataModelProvider(
() => new KiwiJuiceEntities()
),
new ContextConfiguration() { ScaffoldAllTables = true }
);
这篇关于不支持上下文“System.Data.Entity.Core.Objects.ObjectContext”的EF6类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文