Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - Proxy to native object conversion

 
 
Old 06-11-2007   #1 (permalink)
Jon Davis


 
 

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



My System SpecsSystem Spec
Old 06-12-2007   #2 (permalink)
Marc Gravell


 
 

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



My System SpecsSystem Spec
Old 06-14-2007   #3 (permalink)
Jon Davis


 
 

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


My System SpecsSystem Spec
Old 06-16-2007   #4 (permalink)
Marc Gravell


 
 

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

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Inherit from usercontrol - Object not set to instance of an object .NET General
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell


Vista Forums 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 Ltd

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