Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. Object values disappearing

Object values disappearing

Scheduled Pinned Locked Moved WCF and WF
questioncsharpwinformswcf
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dbrenth
    wrote on last edited by
    #1

    I hope I can make sense of this question. I have three projects in the solution: a WCF service, a project with my datacontract classes in it, and a windows forms program consuming the service. If the form doesn't also reference the datacontract classes, all is normal and data is sent and received properly. But now I add a reference to the project with the datacontract classes to my form. The data appears to be sent properly - but my form gets only null references from the WCF service. The only thing I changed was adding the reference. What do I need to do to be able to get the data from my WCF service if my form knows about the datacontract classes? Thanks

    Brent

    K M 2 Replies Last reply
    0
    • D dbrenth

      I hope I can make sense of this question. I have three projects in the solution: a WCF service, a project with my datacontract classes in it, and a windows forms program consuming the service. If the form doesn't also reference the datacontract classes, all is normal and data is sent and received properly. But now I add a reference to the project with the datacontract classes to my form. The data appears to be sent properly - but my form gets only null references from the WCF service. The only thing I changed was adding the reference. What do I need to do to be able to get the data from my WCF service if my form knows about the datacontract classes? Thanks

      Brent

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #2

      dbrenth wrote:

      But now I add a reference to the project with the datacontract classes to my form.

      If I understand you correctly, this is your problem: The datacontract classes are generated ultimately from the ones in your service when you create the proxy classes. The are not the same classes as the one you have referenced in your dll, for one thing they will most likely have a different namespace. If you take a look at the process might be clearer Service data contract --> WSDL --> [Generated] Contract. The resultant generated contract can't be the same as the one included from the service side.You can use the service classes if you are prepared to do all the work that the generated proxy does for you (and out line of creating the Channel can be found inUsing WCF without a generated proxy, by using ChannelFactory[^]) But:

      1. It can be a PITA: I used this methodolgy once and the proxy was simply easier
      2. Unless you have a good reason for wanting to distibute the service side class it goes against the grain of the service architecture IMO

      Sort of a cross between Lawrence of Arabia and Dilbert.[^]
      -Or-
      A Dead ringer for Kate Winslett[^]

      1 Reply Last reply
      0
      • D dbrenth

        I hope I can make sense of this question. I have three projects in the solution: a WCF service, a project with my datacontract classes in it, and a windows forms program consuming the service. If the form doesn't also reference the datacontract classes, all is normal and data is sent and received properly. But now I add a reference to the project with the datacontract classes to my form. The data appears to be sent properly - but my form gets only null references from the WCF service. The only thing I changed was adding the reference. What do I need to do to be able to get the data from my WCF service if my form knows about the datacontract classes? Thanks

        Brent

        M Offline
        M Offline
        Michael J Eber
        wrote on last edited by
        #3

        For your main project you should be adding a Service Reference to the WCF service. Once that is successfully implemented, you will have a local class library to represents the data returned to you by the server. Sometimes you have to look inside the server reference to locate that library but once you find it you can easily access the data.

        Software Zen: delete this;

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups