Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

Proxy to native object conversion

 
 
Thread Tools Display Modes
Old 06-11-2007   #1 (permalink)
Jon Davis
Guest


 

Proxy to native object conversion

In WCF, if I have a class library that is used on both client and server, is
it possible to automate deserializing directly to the class library's real
types, or must I do manual conversion from the proxy client?

Might it suffice to just give it the [Serializable] attribute, rather than
[DataContract] ?

I already implemented with manual proxy conversion, but I'd like to know
that I don't have to do that again if I don't want to (i.e. if the service
will never be exposed to anyone else's codebase).

I like WCF for easily opening endpoints without plumbing code, but not for
its imposition of contracts, which is great for SOA but can be pointless for
internal IPC.

Jon


Old 06-12-2007   #2 (permalink)
Marc Gravell
Guest


 

Re: Proxy to native object conversion

If you have the class library at both ends, you can completely forego
the proxy step; you just need to create (at runtime) a proxy for the
interface in question.

I posted more details on this a little while ago - see 23 May 07, "How
to generate proxy class for client?"

Marc



Old 06-14-2007   #3 (permalink)
Jon Davis
Guest


 

Re: Proxy to native object conversion


"Marc Gravell" <marc.gravell@gmail.com> wrote in message
news:OD2BYNMrHHA.4984@TK2MSFTNGP03.phx.gbl...
> If you have the class library at both ends, you can completely forego the
> proxy step; you just need to create (at runtime) a proxy for the interface
> in question.
>
> I posted more details on this a little while ago - see 23 May 07, "How to
> generate proxy class for client?"


Thanks. So without the proxy, are you still limited to interfaces for the
data structures going back and forth, or can you still use serializeable
classes? (I'm assuming the latter. Not that using full-blown classes is
good design, but there are exceptions.)

Jon


Old 06-16-2007   #4 (permalink)
Marc Gravell
Guest


 

Re: Proxy to native object conversion

Actually, interfaces are not generally (ever?) used to describe the
data structures. Data structures must be concrete in order to re-
construct them at the other end, and hence generally involve concrete
classes (or sometimes a list of known concrete types that subclass /
implement a type / interface). For WCF this could be a [DataContract]
class or a [Serializable] class. At a push you might be able to use
some kind of surrogate setup, but almost always: classes.

An interface is, however, typically used (in WCF) to describe the
service contract - the "what can I do?"; specifically one marked
[ServiceContract] with [OperationContract] members. The documentation
suggests that it is technically possible to use this on a class, but
I've never tried it; this feels naturally like an interface. This has
other advantages: you can implement the interface in a variety of
ways, allowing for some very flexible SOA options; for instance, my
business layer simply asks a factory for "something implementing
ISomeContract" - this *could* be a WCF implementation (in a smart-
client or server-to-server scenario), but could equally be a DAL (in a
rich-client or server-to-database scenario). The business layer
doesn't need to know *what* is providing the service - just what is
available.

Marc

 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Testing object arrays using Compare-Object and -contains Alex K. Angelopoulos [MVP] PowerShell 2 08-31-2006 05:57 PM
Adding canonical aliases for Compare-Object, Measure-Object, New-Object Alex K. Angelopoulos [MVP] PowerShell 2 05-26-2006 07:58 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50