-1

first of all, I want to be clear : I don't know that much on WCF attributes and I'm there to learn about it.

Here is the context : we have a project where we have different forms. Each form contains datas. Some datas are different and some are the same. So we created Structures that are referenced by forms.

Ex : a structure Person contains properties name, age, etc.

Each property has a custom WCF attribute, which specifies the length, if it must be present, etc. Problem is, for some forms, age of a Person is needed, while for others it is not.

Is it possible to change my custom attribute by code when I want, to specify that my custom WCF attribute has now "must be there" or "must not be there" ?

Sorry if I'm not clear enough.

Thanks for reading.

Forceex
  • 3
  • 1
  • 1
    Due to the nature of attributes applying to all instances of an object, you may be on the way down the wrong path. Based upon the current details it sounds like you need a rules engine instead that the form can ask "I have an object of type X, what rules do I need to apply to it for from Y?" in order to dynamically update your UI constraints. – Martin Noreke May 01 '15 at 15:37

1 Answers1

0

No, attributes are baked in to the assembly meta-data at compile time and are readonly at runtime.

Bradley Uffner
  • 16,641
  • 3
  • 39
  • 76