I would like to be able to disable automatic property validation (postsharp injection) for specific properties/methods.
LINQ->SQL entity property setters are unfortunately generated in such a way as they set themselves to NULL as an interim step of the update process (they NULL out the original entity value before updating to the new value).
The result of this is that the property is essentially updated twice. First it sets itself to NULL indirectly via a LINQ EntitySet Remove call, then it updates to the value.
Now we can easily argue that this behavior is stupid, but it's auto-generated code from SQLMetal that I can't really touch.
The problem is, if I decorate these properties via AddValidation calls of NotNull, and allow PostSharp validation... the property setter NotNULL validation *always* fires because of that interim step. So I can set an entity to a non-null
value, and when that entity NULLs itself out as the first step of updating itself, the validation fires and an exception is thrown.
I'd like to be able to call an AddValidation overload where I specify with a boolean whether or not I want property setter validation to run.
I don't want to globally disable property setter validation for all properties... in most cases, I like the setters throwing exceptions on bad data.
Is there another way I've missed to do this?