I am using NHibernate 2.1.2 + Fluent NHibernate
I have a class and a ContactInfo table. The Name column is encrypted in the database (SQL Server) using EncryptByPassphrase / DecryptByPassphrase .
Below are the relevant bits of the circuit / class / map:
table ContactInfo( int Id, varbinary(108) Name) public class ContactInfo { public virtual int Id { get; set; } public virtual string Name { get; set; } } public class ContactInfoMap : ClassMap<ContactInfo> { public ContactInfoMap() { Id(x => x.Id); Map(x => x.Name) .Formula("Convert(nvarchar, DecryptByPassPhrase('passphrase', Name))"); } }
Using the Formula approach, as indicated above, values ββare correctly read from the database, but NHibernate does not try to insert / update values ββwhen saving to the database (which makes sense).
The problem is that I would like to write the Name value using the corresponding EncryptByPassphrase function. I am not sure if NHibernate supports this, and if so, I could not find the right words for an efficient documentation search.
So ... how can I write this computed property back to the database using NHibernate?
Thanks in advance!
source share