0

I have a password field that i would like the user type only between 5 to 10 characters.

However, i will apply md5 and save that value, so i need more space than 10. But StringLength sets nvarchar to 10.

[Required, StringLength(10, MinimumLength = 5)]
public string Password { get; set; }

Resuming, I want to use that validation but thats not what I want to use in DB.

1 Answer 1

1

you should ideally make 2 models. One view model for binding to the posted values and other as a DB model.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.