I am currently working on a project where I have a BankAccount entity for some other entity.
Each bank account as a reference to a bank entity, an account number and opt
I'd make it aspect oriented and reduce coupling.
[IBANVlidator(Message = "your error message. can also come from culture based resouce file.")]
public string IBAN
{
get
{
return _iban;
}
set
{
this.validate();
_iban = value;
}
}
this.validate() is called from the base class of your BankAccount which iterates through all properties having validation attribute. validation atributes are custom attributes derived from ValidationAttribute class which can target class properties.
IBAN validation responsibility then is given to IBANValidator validation-attribute. of course this design can be improved which is beyond the scope of this answer.