Juan said:
Yes, I understand that in most cases the data will need to be serialized
(ie, to reach another AppDomain). But what about a service that is self
hosted, ie. called InProc? Seems to me serialization there is absolutely
pointless and hurts performance. Don't you think?
Well sure but then WCF itself is absolutely pointless in such a
scenario... so it's hard to find fault with the design of WCF on this
account.
I guess you could want to have a service that COULD be self hosted or
COULD be hosted in a separate process/machine - in which case it would
be nice to dispense with the serializing bit. I guess you could just
instantiate the class that implements your DataContract directly from
the client portion of the code and assign it to the same interface that
would normally point to a proxy class... which would mean you could
effectively leave all your client code the same. This is something I'd
planned on investigating myself at some point but haven't tried yet.
One complication with this is that you probably don't want to add
compile time references in the client app to the assembly containing all
the code for the server (and thus the DataContract) but I figure the
instantiation of the server class could be done on the client using
reflection in the case that the client was self hosting the server.
Another complication is that the DataContract may be reliant to some
extent on various context features of WCF, such as the security
principal and claims established during authentication and
authorization. If that's the case then the design is necessarily going
to get quite complicated if you want to dispense with WCF so it might be
worth asking whether you actually have a performance problem or if
you're just being anal (not you personally, I'm talking about a general
you here) and if it isn't just easier to go with the IPC Channel.
Best Regards,
James Crosswell
Microforge.net LLC
http://www.microforge.net