I have a user model with two [NotMapped] string properties Password and ConfirmPassword. These are unmapped because I save password as byte array (after salting) so there are two additional properties (mapped) InternalPassword and Salt in user model.
The problem is when I use the user model to change password, entity framework throws DBEntityValidation error stating "The Password property is required." What I understand here is that EF is trying to validate my model before saving and since Password/ConfirmPassword are not set, it is throwing this error. This raises following questions:
1) If property Password is explicitly annitated as [NotMapped], why is EF validating it during save? 2) IF EF performs validation during save, and the same is also performed during binding (I.E. in the controller action method), does it not hurt performance? (validating twice) 3) What's the recommended way to resolve this error? (If I explicitly set Password property to dummy value, error is gone.)
Edit: I've removed the code since it is lengthy and may be the cause of no answer yet. If somebody wants to have a look, I can append it below.