none
trouble referencing WCF project that references models that implement INotifyPropertyChanged RRS feed

  • Question

  • My solution contains 3 projects.

    1. WPF application (Views and View Models)
    2. Class Library (Models)
    3. WCF service

    The Models all inherit from a simple, common base class I created that implements INotifyPropertyChanged. 

    Not that I’ve explained the setup, let me share my problem:

    I get the error at the end of this post when I try to add or update the service reference in the WPF project.  The error will go away if I modify the Models to not use the INotifyPropertyChanged base class.  So, this seems to be the root of the issue, and I seem stuck trying to figure out how to add a WPF Service refrence to a WCF service that references classes that impelemnt INotifyPropertyChanged.

    Any assistance will be greatly appreciated.

    Thanks!

    Craig

    There was an error downloading 'http://localhost:8733/Design_Time_Addresses/ProjectName/Service1/mex/_vti_bin/ListData.svc/$metadata'.
    The request failed with HTTP status 400: Bad Request.
    Metadata contains a reference that cannot be resolved: 'http://localhost:8733/Design_Time_Addresses/ProjectName/Service1/mex'.
    Metadata contains a reference that cannot be resolved: 'http://localhost:8733/Design_Time_Addresses/ProjectName/Service1/mex'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    Friday, January 30, 2015 8:54 PM

Answers

  • The base class implementing INotifyPropertyChanged did not include the [DataContract] attribute.  Adding this attribute to the class resolved the error.
    • Marked as answer by CraigStewart Friday, February 6, 2015 2:34 PM
    Friday, February 6, 2015 2:34 PM

All replies

  • You should not be using any objects that have some kind of mark object dirty events on a object's public property setter, because it gets fired on the serialize and deserialize of the  object sent between the WCF client and service marking the object has changed when the object was never changed via a programs interactions with the object to make a change to the object programmically.   
    Sunday, February 1, 2015 12:10 AM
  • The base class implementing INotifyPropertyChanged did not include the [DataContract] attribute.  Adding this attribute to the class resolved the error.
    • Marked as answer by CraigStewart Friday, February 6, 2015 2:34 PM
    Friday, February 6, 2015 2:34 PM