You get a cross-domain web services warning when debugging your silverlight application. This can be caused simply by leaving the wrong project highlighted when you hit F5. Select your .web project or the project that contains the aspx file hosting the application. If you run debugger with the silverlight project (containing your page.xaml) selected, you get this error.
Category Archives: Silverlight
Silverlight and LINQ problems: ‘YourDataClassesDataContext’ does not contain a constructor that takes ‘0’ arguments
After rebuilding my DBML file with SQL metal, my DataContext class no longer has a parameterless constructor. This is due to differences between the was that Visual studio generates the DBML (with SQL metal) and how SQLMetal command-line does by default.
The parameterless constructor simply takes the connection string from web.config rather than requiring one to be passed in as an argument. There may be switches for SQLMetal to handle this, but in the mean time here is a quick solution (which is simply what VS2008 adds when using the DBML builder) :
Add the following method to the DataClasses.designer.cs
public MyDataClassesDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings[“MyConnectionString”].ConnectionString, mappingSource)
{
OnCreated();
}