目前我在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因爲即使對你的問題的部分理解也需要閱讀很長的博客文章,也許還需要檢查源代碼。您應該儘自己的努力將問題本地化或者用幾段描述它。這從你身邊漫長而相當慵懶。 –