I haven't tried this, but I see no reason why it wouln't work (the geek version of famous last words):
Code:
public class User
{
private string username;
private string password;
public string Username
{
get { return username; }
set { username = value; }
}
public string Password
{
get { return password; }
set { password = HashPassword(password); }
}
}
In your mapping file, just specify the access as nosetter.camelcase (or whatever your standard is)
Code:
<class name="FinApp.User, FinApp" table="Users">
<id name="Username" type="String">
<column name="username" not-null="true" unique="true"/>
<generator class="assigned" />
</id>
<property name="Password" column="password" access="nosetter.camelcase" />
</class>
Then, when your UI sets the property, it hashes it. When nhibernate sets the property, it will do so by setting the field directly.