views:

49

answers:

3

In my client, I'm trying to declare an entity type from the service....

MyService.MyClass myClass = new MyService.MyClass();
....

MyClass isn't available.

The assembly MyClass is within is referenced by MyService. What am I missing?

+1  A: 

From the client's perspective, the service is just the interface, the client doesn't have access to the guts of the server. The types you might need should be exposed as part of a contract externally (like in a seperate assembly).

McKay
Well, this would basically be like using a DTO, except rather than going about using a separate class and mapping it within the service I just use the class from the service.
suedeuno
A: 

You probably want to Add Service Reference. Note that the generated class will have a slightly differnt name/namespace to your server implementation.

Ruben Bartelink
+1  A: 

Generally, to preserve the service boundary, you work with mex-generated proxy classes at the client; these are structure only, so don't have any methods etc (just properties), and may even have different names (and almost certainly a different namespace).

However; if this .NET to .NET, you can get WCF (via either svcutil or the IDE) to re-use types in existing assemblies. Via the IDE it does this automatically (by default - you can disable it) if you have a reference to a dll containing matching types. At the command line, you use /r IIRC.

Marc Gravell