目前我在C#中使用的存储库模式从this blog。该项目的代码可以找到here。实体框架4,Poco - 实体数据模型问题
现在所有似乎都可以工作,但我的项目中有一个实体数据模型(.edmx),我希望使用此代码。
此刻我有了这个代码:
public UnitTest1()
{
ObjectContextManager.InitStorage(new SimpleObjectContextStorage());
ObjectContextManager.Init("TraceDb", new[] { "Infrastructure.Test" });
repository = new GenericRepository();
}
但这似乎并没有工作,注意的.edmx的该架构命名为“Trace.DAO.Entity”。但是,对于.edmx的.Designer.cs的名称空间“Infrastructure.Test”,测试也不会正常运行。
Ps。这是错误我得到:
Failed TestMethod1 Infrastructure.Test Unable to create instance of class Infrastructure.Test.UnitTest1. Error: System.ArgumentException: No mapping class found!.
任何人都得到一个解决方案,我的问题或知道如何使用的.edmx这个源代码?
-1因为即使对你的问题的部分理解也需要阅读很长的博客文章,也许还需要检查源代码。您应该尽自己的努力将问题本地化或者用几段描述它。这从你身边漫长而相当慵懒。 –