我们怎样才能DynamicData与EFPocoAdapter工作吗? [英] How can we get DynamicData working with EFPocoAdapter?

查看:136
本文介绍了我们怎样才能DynamicData与EFPocoAdapter工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队希望利用EFPocoAdapter,而且还希望利用DynamicData工具,它但有一些问题。

My team is hoping to use the EFPocoAdapter, but are also hoping to use the DynamicData tools with it but are having some issues.

我们基本上增加了动态数据实体的Web应用程序项目的EFPocoAdapter罗斯文样品溶液(我使用的是最新版本,1.03),引用所需的组件,然后取消注释和编辑在Global.asax.cs中的行文件与元模型注册一个上下文是这样的:

We basically added a "Dynamic Data Entities Web Application" project to the EFPocoAdapter Northwind sample solution (I am using the latest version, 1.03), referenced the needed assemblies and then uncommented and edited the line in the Global.asax.cs file that registers a context with the MetaModel to look like this:

model.RegisterContext(typeof(NorthwindEF.NorthwindEntities), 
      new ContextConfiguration() { ScaffoldAllTables = true });

我们得到这个错误:上下文类型NorthwindEF.NorthwindEntities不支持。

We get this error: "The context type 'NorthwindEF.NorthwindEntities' is not supported."

我们的问题是,如何才能使这是一个有效的上下文或者我们还能怎么破解的东西,使这项工作我们呢?

The question we have is, how can we make this a valid context or how else can we hack things to make this work for us?

任何指针是AP preciated,谢谢。

Any pointers are appreciated, thanks.

推荐答案

您需要添加DynamicData.EF codeFirstProvider,可从的NuGet,只需搜索EF codeFirstProvider。然后,可以使用:

You need to add the DynamicData.EFCodeFirstProvider, available from Nuget, just search for EFCodeFirstProvider. Then you use:

DefaultModel.RegisterContext(
            new EFCodeFirstDataModelProvider(() => new NorthwindEF.NorthwindEntities()),
            new ContextConfiguration() { ScaffoldAllTables = true });

这篇关于我们怎样才能DynamicData与EFPocoAdapter工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆