Custom classes and DataContracts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SyntaxError

    Custom classes and DataContracts

    Here's the situation folks.

    I have two WCF Services, CustomerDALC and PricingDALC.
    I have a desktop application containing service references to both of these.
    This was done via the VS IDE.

    On the server-side, CustomerDALC and PricingDALC use the same Customer.cs
    class file (a [DataContract] with [DataMember] attributes).

    From the desktop application, when I use CustomerDALC to get a customer and
    then call PricingDALC which takes a Customer object as a parameter, I get
    the following error at compile time:

    Error 2 Argument '1': cannot convert from
    'MarginCalculat or.CustomerDALC .Customer' to
    'MarginCalculat or.PricingDALC. Customer' C:\SourceSafeLi b2008\Desktop
    Applications\Ma rginCalculator\ Logic.cs 92 17 MarginCalculato r

    How can I overcome this? I've tried serializing the CustomerDALC.Cu stomer
    object using XMLSerializer and then deserialize into a PricingDALC.Cus tomer
    object, but receive an error during deserialization . Please help.

  • SyntaxError

    #2
    Re: Custom classes and DataContracts

    If the property is read-only, the serializer won't be able to recreate the
    property on the client side. The property needs to be read/write. For this
    reason, your DataContracts should be separated from your business classes.

    "SyntaxErro r" <visit@marcone. comwrote in message
    news:1989AC5B-DAF4-4B57-993F-C9BC11C05FA0@mi crosoft.com...
    Here's the situation folks.
    >
    I have two WCF Services, CustomerDALC and PricingDALC.
    I have a desktop application containing service references to both of
    these. This was done via the VS IDE.
    >
    On the server-side, CustomerDALC and PricingDALC use the same Customer.cs
    class file (a [DataContract] with [DataMember] attributes).
    >
    From the desktop application, when I use CustomerDALC to get a customer
    and then call PricingDALC which takes a Customer object as a parameter, I
    get the following error at compile time:
    >
    Error 2 Argument '1': cannot convert from
    'MarginCalculat or.CustomerDALC .Customer' to
    'MarginCalculat or.PricingDALC. Customer' C:\SourceSafeLi b2008\Desktop
    Applications\Ma rginCalculator\ Logic.cs 92 17 MarginCalculato r
    >
    How can I overcome this? I've tried serializing the CustomerDALC.Cu stomer
    object using XMLSerializer and then deserialize into a
    PricingDALC.Cus tomer object, but receive an error during deserialization .
    Please help.
    >

    Comment

    Working...