Geeks With Blogs

News

Locations of visitors to this page




Adrian Hara Working through the .NET maze
Today I experienced what appears to be a small WSSF gotcha :)

If you have a Data Contract which has a Data Member called Value (for example contract is ParameterInfo, so having a member called Value might make sense), the code that gets generated by WSSF looks like so:

private string value;

[WcfSerialization::DataMember(Name = "Value", IsRequired = true, Order = 1)]

public string Value

{

  get { return value; }

  set { value = value; }

}    


Obviously, what happens is that in the property setter...well...nothing happens ;). The code generator doesn't prefix the assignment with "this", so we'd have "this.value = value", meaning that the data member will always have the default value for its type (in this case, because it's string, that'd be null).

Now I admit that having a property named "Value" is questionable, but I might argue that, using WSSF, the whole point is to model the contracts in an implementation-oblivious manner, so it should be perfectly fine to have such a data member name.

Anyway, you probably can poke into the code generation and fix this, and probably I would've tried it, but it turns out that my "Extending the WSSF Hands-On-Labs.chm" is not working ("page cannot be displayed"). So if anyone has a fix for this (other than renaming the data member), please shout ;) Posted on Tuesday, March 3, 2009 4:06 PM | Back to top


Comments on this post: WSSF Data Contract member names

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Adrian Hara | Powered by: GeeksWithBlogs.net