0
votes

Trying to add WCF RIA Services class library to my SL5 app in VS 2010 but once I set the WCF RIA Services Link in class library properties, project fails to build with numerous "The type or namespace name 'QueryResult' could not be found", 'EntitySet', EntityQuery' errors...

I'm following the MSDN Walkthrough Walkthrough: Creating a RIA Services Class Library trying to port a subset of my WPF app to SL5 so I first created an SL5 application with RIA checkbox uncheked which created two projects:

  • MySLApp (Silverlight 5)
  • MySLApp.Web (.NET 4)

Once I had that in place I added WCF RIA Services class library which created another two projects:

  • MySLAppWCF (Silverlight 5)
  • MySLAppWCF.Web (.NET 4)

In MySLAppWCF.Web I created an ADO .NET Entity Data Model and added a Domain Service Class using an entity from the Data Model. At this point all these new projects buid fine so I added a reference to MySLAppWCF in my MySLApp project and a reference to MySLAppWCF.Web in my MySLApp.Web but the final step to get all this wired up is to set the WCF RIA Services Link in MySLAppWCF to MySLAppWCF.Web but once I do that it all blows up with numerous "The type or namespace couldn not be found" errors. I checked the references in the library and there is a reference to System.ServiceModel there.

Any ideas on how to get all this working?

EDIT: I kept digging and found something about adding a reference to System.ServiceModel.DomainServices.Client library which is located in RIA SDK so I did that and it took care of the original errors but now I'm getting WebDomainClient and DomainServiceFault not found in my MySLAppWCF project even after adding a reference to System.ServiceModel.DomainServices.Client there as well and these two appear to be in that namespace...

1

1 Answers

1
votes

Both WebDomainClient and DomainServiceFault are definied in System.ServiceModel.DomainServices.Client.Web (usually found at C:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight\System.ServiceModel.DomainServices.Client.Web.dll)
You need to add a reference to this assembly too.

Let me assert that your design could bring you to some problems, having two different sites (one that host the SL application and one to host the domainServices) it's unusual and could bring you in cross-request problem, if it isn't needed I suggest you to transform MySLAppWCF.Web into a normal DLL and reference it from your host.

Also, pay attention at the web.config of MySLAppWCF.Web, VS has modified it in order to use the needed DomainServiceModule.