Using EF Code First, how can I interrupt saving a field value so that I can use it? A simple example is the password field:
public class Account
{
private string _password;
public string Password
{
get
{
return _password;
}
set
{
_password = MyHashMethod(value);
}
}
}
This seems to work when storing the value in the database, but does not work when retrieving the value.
EDIT: Changed _password = MyHashMethod (_password) to MyHashMethod (value) above. The answer below should be made the same correction.
source
share