![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | Converting proxy generated types to original types I have a WCF Service called "MyService". It references a DLL that defines a type called "SomeLib.MyType". "SomeLib.MyService" exposes the following contract method: [OperationContract] SomeLib.MyType MyMethod(); On the client side, a proxy is being generated for MyType, let's call it "MyProxy.MyType". Simple stuff. Now, say I have a library that performs calculations on SomeLib.MyType. It has a simple signature: namespace MyLibrary { public class MyCalculator { public int Calculate(SomeLib.MyType x) { do something special } } } The question is, how can I utilize "MyLibrary" from the client? I can't pass "MyProxy.MyType" to "Calculate", because "MyType" on the client it is generated as part of the proxy (via svcutil.exe). Casting from MyProxy.MyType to SomeLib.MyType doesn't work (and perhaps is dangerous). Is there any other way of doing it, without writing a converter from "MyProxy.MyType" to "SomeLib.MyType"? Thanks in advance. |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Converting proxy generated types to original types Thus wrote Daniel, > I have a WCF Service called "MyService". It references a DLL that > defines a type called "SomeLib.MyType". "SomeLib.MyService" exposes > the following contract method: > > [OperationContract] > SomeLib.MyType MyMethod(); > On the client side, a proxy is being generated for MyType, let's call > it "MyProxy.MyType". Simple stuff. > > Now, say I have a library that performs calculations on > SomeLib.MyType. > It has a simple signature: > namespace MyLibrary > { > public class MyCalculator > { > public int Calculate(SomeLib.MyType x) { do something special > } > } > } > The question is, how can I utilize "MyLibrary" from the client? I > can't pass "MyProxy.MyType" to "Calculate", because "MyType" on the > client it is generated as part of the proxy (via svcutil.exe). > Casting from MyProxy.MyType to SomeLib.MyType doesn't work (and > perhaps > is dangerous). > Is there any other way of doing it, without writing a converter from > "MyProxy.MyType" to "SomeLib.MyType"? In that case, you're much better off sharing these types between client and server -- in your scenario these are tightly coupled anyway. Put the shared types in a separate assembly, deploy it on both client and server, and use ChannelFactory<T> instead of svcutil-generated proxies in your client code. Cheers, -- Joerg Jooss news-reply@joergjooss.de |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting array elements between types | Kryten | PowerShell | 6 | 03-01-2008 12:25 PM |
| File types | Ernie Lane | Vista General | 4 | 10-17-2007 10:25 PM |
| File Types | dev | Vista General | 4 | 07-16-2006 05:45 PM |
| File Types | =?Utf-8?B?VGVhbWhyYw==?= | Vista General | 0 | 07-07-2006 01:41 PM |