Entity Frameworkを使用してWPFアプリケーションを作成していますが、WindowとWindowsに埋め込まれたUserControlの2つのコントロールがあります。UserControl Designerは正常に機能しますが、WindowDesignerは例外を返します。
The specified named connection is either not found in the configuration, not
intended to be used with the EntityClient provider, or not valid.
例外は、UserControlコードの行にあります-エンティティのインスタンスを作成する場所の後ろにあります。
public partial class Table : UserControl
{
private MyEntities entity;
public Table()
{
InitializeComponent();
entity = new MyEntities();
}
}
アプリを実行すると、すべてが正常に機能します。
編集
ここで解決策を見つけました:WPFデザイナーはエンティティフレームワークをロードしませんが、VS2010を使用していて、しばらく前にこのアプローチ(同じ場所にエンティティのインスタンスを作成する)は正常に機能しましたが、何が壊れたかわかりませんそれをダウンします。