开发者

Can required WCF4 DataMemeber's be organized into required groups?

Is there a way to have required DataMember's within a DataContract to be organized into groups s开发者_Python百科o that you really only require group one or group two but no both to be provided?

I am looking to see if there is functionality similar to Workflow Activity validation where you can flag InArgument's with a RequiredArgument and then use OverloadGroup attribute to put these into groups so that only the arguments in one of the specified groups are required.


It is not possible out of the box with DataContractSerializer but you can switch to XmlSerializer and use xsd:choice (XmlChoiceIdentifierAttribute) but be aware that this will affect your data class beacuse this construct has its own requirements.


Nope, there is no way to do this. Only way to group is to have two different classes and extract away members/properties into those classes, but still...you won't be able to dictate an "either-on" setting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜