Class Libraries, Silverlight, and Webservices

I have a Silverlight class library that I want to use in both my Silverlight and my WebService project.

I can create and reference the library in both projects without any problems, but when I try to use any of the classes in the library of the Silerlight project, I get an ambiguous link error between my library and Asmx Webservice (apparently, the silverlight project considers that classes in the class library exist in webservice).

How can I fix this problem? I tried to restore and clean, but it does not seem to work. Can anyone help?

+2
source share
2 answers

It appears that the objects you pass to Silverlight through the WCF service are the same objects in your class library. In this case, the created web link objects will be assigned the same names. Linking to the library will give you 2 sets of objects with the same name.

If you install RIA services, once the function is the ability to share code between the client and server, simply by adding ".shared" to the class file names before the extensions. ASMX services so past centuries :)

if you do not want to learn how to provide RIA services for sharing objects through a large website separator (which I would recommend), you need to separate the data objects from the functionality on which you really want to share the client and server side.

, , .

0

, , - :

using MyNameSpace = My.Name.Space;
using MyWebService = My.Web.Service;

, .

0

All Articles