You will need to cast the datatype explicitly, even though you know it's the
same type. It seems redundant, but if you think about it, there's only one
workaround, which is to have both the Web service and the client reference
the same type definition assembly. To do this, you would (ideally) generate
an XSD file for the custom type, then use xsd.exe to generate the code
definition of the type. You would then compile this definition into an
assembly, that you could reference from clients, services, whoever needed
access to the exact same type definition.
Of course, this approach is not practical in most cases, and it creates a
level of tight coupling that goes against SOA tenets. So you pretty much
have no choice but to treat the Web Service version and the local version as
two separate data types that can cast to eachother. I would still generate
an XSD definition, because this abstracts the definition away from any one
implementation.
Jeffrey Hasan, MCSD
President, Bluestone Partners, Inc.
-----------------------------------------------
Author of: Expert SOA in C# Using WSE 2.0 (APress, 2004)
http://www.bluestonepartners.com/soa.aspx
"John Wilson" <JW@nospam.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my
data objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and
placed this on the local machine and the webserver.
When I get my Object A back from the webserver, Visual Studio tells me
that it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same
objects?
I appreciate your help, please let me know if the above makes no sense.
JW
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my
data objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and
placed this on the local machine and the webserver.
When I get my Object A back from the webserver, Visual Studio tells me
that it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same
objects?
I appreciate your help, please let me know if the above makes no sense.
JW