我不斷收到此錯誤:WPF和ADO.NET EF - 錯誤
Microsoft.Practices.Composite.Modularity.ModuleInitializeException was unhandled
Message=An exception occurred while initializing module 'DiagrammerModule'.
- The exception message was: An exception has occurred while trying to add a view to region 'MainRegion'.
- The most likely causing exception was was: 'System.ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
....
連接字符串存儲在app.config中,看起來像這樣:
<connectionStrings>
<add name="DBEntities" connectionString="metadata=res://DataAccessLayer/EntityDataModel.csdl|res://*/EntityDataModel.ssdl|res://*/EntityDataModel.msl;provider=System.Data.SqlServerCe.3.5;provider connection string="Data Source=|DataDirectory|\DB.sdf;Password=password;Persist Security Info=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
其中DataAccessLayer是名稱包含模型和實體的DLL的一部分。
該代碼有什麼問題?
感謝您的幫助。
我也許應該補充一點,這是棱鏡應用。我正在按照這個解決方案(滾動到頁面的底部)插入一個dll的名稱:http://geekswithblogs.net/hoarked/archive/2009/02/04/creating-a-wpf-application -with棱鏡-V2-ndash的-瀏覽-module.aspx – Enzomatric 2010-06-19 17:10:57