![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Sharing assembly between client and service I am writing a simple application that requires communication between a couple .NET applications and a .NET windows service, all running on the same computer. I have complete control over all endpoints. I am using WCF but am finding it difficult to share a class/assembly between client and service. Should I be using Remoting instead? My service contract has these functions: MyConfiguration GetConfiguration(); void SaveConfiguration(MyConfiguration c); The MyConfiguration class encapsulates data and a bunch of validation logic and behavior. The client needs to work with this to present a proper UI and validate the data. The service also needs to work with the same data and validate it before persisting it. So I'd like to share this class between client and service so I can avoid duplicate work. I understand why this coupling of client and service can be a bad thing in some circumstances, but here it seems fine. The proxy generation in Visual Studio creates a different class for the client to work with - one that only has the data and no validation logic. How can I get the service and the client to both work with the same class? Do I always have to do a manual conversion between the proxy class and the fully-functional one? Am I going about this wrong? |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Sharing assembly between client and service You could use the ChannelFactory class. using (ChannelFactory<MyServiceInterface> factory = new ChannelFactory<MyServiceInterface>("MyClientConfig")) { MyServiceInterface service = factory.CreateChannel(); // Execute service mthods.. } "jmagaram" <jmagaram@discussions.microsoft.com> wrote in message news:FC20EED4-CCB3-4644-8DA0-9BAF506F515E@microsoft.com... >I am writing a simple application that requires communication between a > couple .NET applications and a .NET windows service, all running on the > same > computer. I have complete control over all endpoints. I am using WCF but > am > finding it difficult to share a class/assembly between client and service. > Should I be using Remoting instead? > > My service contract has these functions: > > MyConfiguration GetConfiguration(); > void SaveConfiguration(MyConfiguration c); > > The MyConfiguration class encapsulates data and a bunch of validation > logic > and behavior. The client needs to work with this to present a proper UI > and > validate the data. The service also needs to work with the same data and > validate it before persisting it. So I'd like to share this class between > client and service so I can avoid duplicate work. I understand why this > coupling of client and service can be a bad thing in some circumstances, > but > here it seems fine. The proxy generation in Visual Studio creates a > different > class for the client to work with - one that only has the data and no > validation logic. How can I get the service and the client to both work > with > the same class? Do I always have to do a manual conversion between the > proxy > class and the fully-functional one? Am I going about this wrong? |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Sharing assembly between client and service To keep your logic in place, you could use a custom DataContract Serializer, and serialize your data into your shared class that contains the logic. Use the <DataContractSerializer> element to specify it. -HTH "Mariano Omar Rodriguez" wrote: > You could use the ChannelFactory class. > > using (ChannelFactory<MyServiceInterface> factory = new > ChannelFactory<MyServiceInterface>("MyClientConfig")) > { > MyServiceInterface service = factory.CreateChannel(); > // Execute service mthods.. > } > > "jmagaram" <jmagaram@discussions.microsoft.com> wrote in message > news:FC20EED4-CCB3-4644-8DA0-9BAF506F515E@microsoft.com... > >I am writing a simple application that requires communication between a > > couple .NET applications and a .NET windows service, all running on the > > same > > computer. I have complete control over all endpoints. I am using WCF but > > am > > finding it difficult to share a class/assembly between client and service. > > Should I be using Remoting instead? > > > > My service contract has these functions: > > > > MyConfiguration GetConfiguration(); > > void SaveConfiguration(MyConfiguration c); > > > > The MyConfiguration class encapsulates data and a bunch of validation > > logic > > and behavior. The client needs to work with this to present a proper UI > > and > > validate the data. The service also needs to work with the same data and > > validate it before persisting it. So I'd like to share this class between > > client and service so I can avoid duplicate work. I understand why this > > coupling of client and service can be a bad thing in some circumstances, > > but > > here it seems fine. The proxy generation in Visual Studio creates a > > different > > class for the client to work with - one that only has the data and no > > validation logic. How can I get the service and the client to both work > > with > > the same class? Do I always have to do a manual conversion between the > > proxy > > class and the fully-functional one? Am I going about this wrong? > > |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print sharing: XP client to Vista service in domain | Dave Harry | Vista networking & sharing | 2 | 10-10-2007 12:06 AM |
| Client Service for Netware | Badger | Vista installation & setup | 0 | 09-14-2006 01:33 PM |