Say I have defined a custom AdapterElement : ConfigurationElement
with properties Type
, Name
and Version
. Since Name
and Version
uniquelly identifies the Type
property, I would like to enforce the configuration file to have one of the following structures:
<adapter type="TypeOfAdapter"/>
<adapter name="NameOfAdapter" version="VersionOfAdapter"/>
I could easily mark those three properties with IsRequired = false
and let users specify the combination the want. However, the following combinations are not valid and I would like to forbid them:
<adapter type="TypeOfAdapter" version="VersionOfAdapter"/>
<adapter type="TypeOfAdapter" name="NameOfAdapter"/>
Is there any easy way of achieving this?