"System.ComponentModel.PropertyChangedEventHandler" cannot be obtained from the special class "System.MulticastDelegate"

I am developing a wcf service recommended here . It solved my original problem of namespace conflicts when developing the original .NET 2.0 web service, but I ran into another problem.

The object that I am trying to pass to the wcf service is used in the client to aggregate a bunch of information from the user, and some of its fields are attached to ui controls (therefore, implement PropertyChangedEventHandler). When I try to compile the proxy server generated by svcutil in my client project, I get an error message that asks this question.

Pulling all the data from this object and including it in the class for sending (and then restoring the original type) seems redundant - not to mention ridiculously long time.

Is there a workaround?

+5
source share
1 answer

Can I check? Do you pass the delegate to the web service? This will not work ... it cannot be serialized. In the best case, ADO.NET Data Services (.NET 3.5SP1) can do something similar by translating Expressioninto a query string ... but it will be as close as possible. In addition, you will have to create a request object that encapsulates your intentions using the usual properties.

This applies to any web service, wcf service, tcp, etc.

* = - , , ( ()); , , xml


()

- , -; , ( ). :

[DataContract]
class Foo : IWhateverInterfaces {
    [DataMember]
    public string Bar {get;set;}

    [DataMember]
    public int Baz {get;set;}

    public float NotPartOfTheContract {get;set;}

    public event EventHandler AlsoNotPartOfTheContract;
}

[DataContract] , [DataMember], , . WCF- , MS ... IMO, , ...

+5

All Articles