0
votes

I removed [DataMember] attribute from all of my public properties, yet the properties are still showing up in the results of my WCF operations. I found this link here that explains if .Net is on both ends of the wire, then DataMember doesn't have much of an effect on determining what properties are included in the DataContract.

So, how do you exclude public properties from being included in WCF results?

Thanks

1
With attribute IgnoreDataMember?vortexwolf

1 Answers

1
votes

There are several different ways that the serialization in WCF can work. They are outlined here. Note that [Serializable] classes can also be used.

Note the last item in that list: Starting with 3.5 SP1, classes that are not annotated with any option would still be serializable by the WCF infrastructure. If you do that, however, you're left with no way to control how that serialization happens and what properties are serialized (which is why I personally feel that option was a mistake to add, but that's another story).

Is there any reason why you removed the [DataContract][DataMember] attributes?