![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | 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) |
| | 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 | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Converting array elements between types | PowerShell | |||
| Simple Types | PowerShell | |||
| File Types | Vista General | |||
| File Types | Vista General | |||