编辑:我已经提交了一个错误报告,微软承认这是一个错误。目前没有关于何时修复的预计时间。
错误报告: https ://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=386982
我有一个按以下方式构建的解决方案。
- 实体框架项目
- 数据访问项目
- WPF应用项目
WPF 应用程序调用数据访问项目中的方法,这些方法从实体框架项目中获取数据并将其绑定到 XAML 中。
例如
<UserControl.Resources>
<ObjectDataProvider x:Key="tokens"
ObjectType="{x:Type ctl:MerchantNetworkController}"
MethodName="ListMerchantNetworkTokens" />
</UserControl.Resources>
我遇到的问题是,当我从数据访问项目调用函数时,VS 2008 设计器不会加载,但是我可以编译并运行该解决方案。
当我在 XAML 后面的代码中创建一个函数并使用它而不是数据访问项目时,它工作正常并且设计器实际加载。当我调用数据访问项目时,就会出现问题。
我从设计师那里得到的错误信息是
"The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid"
我在WPF项目和数据访问项目的App.config中有如下连接字符串
<add name="Entities"
connectionString="metadata=C:\EFModel\Model.csdl|C:\EFModel\Model.ssdl|C:\EFModel\Model.msl;
provider=System.Data.SqlClient;
provider connection string='Data Source=localhost;Initial Catalog=database;Persist Security Info=True;User ID=username;Password=password;MultipleActiveResultSets=True'"
providerName="System.Data.EntityClient" />
我正在使用 VS 2008 sp1、.NET 3.5 sp1、Vista 32 位