I have a wpf app that uses a wcf webservice. Its my webservice and app, so I can make changes to either side. In the Reference.cs file that gets automatically genereated by visual studio it uses this code for the property changed event:
[System.Runtime.Serialization.DataMemberAttribute()]
public string Value {
get {
return this.ValueField;
}
set {
if ((object.ReferenceEquals(this.ValueField, value) != true)) {
this.ValueField = value;
this.RaisePropertyChanged("Value");
}
}
}
For strings though what I would really like is this:
[System.Runtime.Serialization.DataMemberAttribute()]
public string Value {
get {
return this.ValueField;
}
set {
if ((object.ReferenceEquals(this.ValueField, value) != true)) {
if (this.ValueField != value)
{
this.ValueField = value;
this.RaisePropertyChanged("Value");
}
}
}
}
That way the property changed event would not go off if the value is the same. Why this is an issue is because I listen to the OnPreviewTextInput of a textbox and change the value programmatically, then the event goes off twice, once because I changed it and once because wpf changed it via binding.
Thanks,
If you control both the server and the client, you can define your type in a seperate assembly, which you then reference from both projects.
In the WCF reference add dialog advanced settings you can tell it to re-use types, then it will use whatever implementation of your data object exists in the common assembly on the client.