There are several ways you can access SQL data from Silverlight. As you said, using a WCF web service might be a good option. Though Prism-v2 does not provide any special infrastructure to expose or consume web services,
you should be able to use WCF as in any other Silverlight project.
The error you mention is probably because of a naming conflict between the
HelloWorldModule namespace and the HelloWorldModule class. The service proxy client generated by WCF (Reference.cs) uses full names, so it will generate for example
HelloWorldModule.ServiceReference1.IService1 (trying to make reference to
HelloWorldModule namespace) but it will fail compiling because this way is referencing an unexisting
ServiceReference1 type inside the HelloWorldModule class.
To work around this issue you should do one of the following (in my personal preferred order):
1. Refactor the solution to change the name of the
HelloWorldModule class (you might need to change the prism module configuration).
2. Refactor the solution changing the name of the
HelloWorldModule namespace (you might also need to change the project name, the project's default namespace and any configuration referring that namespace).
3. Modify the generated code removing the
HelloWorldModule prefix (for example modify all
HelloWorldModule.ServiceReference1.IService1 to ServiceReference1.IService1). The drawback of this approach is that any update to the service (using the
Update Service Reference option) will undo your changes.
Once that compilation error is resolved, take into consideration the run-time error discussed in the following post:
How-to: Consume WCF services from Composite Application Guidance for WPF and Silverlight(Prism-v2) Modules.
There are some other discussions in the forum related to consuming web services in prism:
Hope it helps!