I am extending the MembershipUser and MembershipProvider classes. I am using an ORM.
I am wondering – the MembershipUser class has no Password property, yet there are methods that return its password and change its password and so on. I had first thought that, using the ORM approach, we could do:
user.password = newPassword;
session.commit();
But it seems that the MembershipUser is not supposed to have any password property or field and instead it must be set via SQL (so will have to create the query)?
To make my question clearer:
If the MembershipUser class has a password field, I could do something like this in the updatePassword method of the MembershipProvider:
User user = from database.getUser(username, oldpassword);
user.password = newPassword;
session.commit();
But if I can’t have a password field, I have to use SQL:
UPDATE password SET.. etc etc… as I can’t get and change OBJECTS from the database as the objects don’t have the fields I need to change (such as the password field).
I ended up creating a wrapper class around the MembershipUser with all virtual fields that could be manipulated. I created a ToMembershipUser method to satisfy the MembershipProvider methods.