WPF designer won't load when binding datasource from entity framework
Asked Answered
M

1

8

EDIT: I have submitted a bug report and Microsoft have acknowledge that it is a bug. There is currently no ETA on when it will be fixed.

Bug Report: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=386982

Official Feedback: http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/ca3cac55-c1de-4e65-9543-e95484ad78c5/

I have a solution structured in the following way.

  • Entity framework project
  • Data access project
  • WPF application project

The WPF application calls methods in the data access project which gets it's data from the entity framework project and binds it in XAML.

e.g.

<UserControl.Resources>
      <ObjectDataProvider x:Key="tokens" 
                            ObjectType="{x:Type ctl:MerchantNetworkController}" 
                            MethodName="ListMerchantNetworkTokens" />
</UserControl.Resources>

The problem i have is that the VS 2008 designer won't load when i call functions from the data access project, I can however compile and run the solution fine.

When i create a function in the code behind of the XAML and use that instead of the data access project it works fine and the designer actually loads. The problem just occurs when i make a call to the data access project.

The error message i get from the designer is

"The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid"

I have the following connection string in the App.config of the WPF project and the data access project

<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" />

I am using VS 2008 sp1, .NET 3.5 sp1, Vista 32 bit

Mimetic answered 6/12, 2008 at 5:6 Comment(0)
H
2

Ya, this sucks. I've had to deal with this before. Best thing you can do is make your controller function return fake data when in design view.

Hypothec answered 12/1, 2009 at 5:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.