Featured post
Writing computed properties with NHibernate -
i'm using nhibernate 2.1.2 + fluent nhibernate
i have contactinfo
class , table. name
column encrypted in database (sql server) using encryptbypassphrase
/decryptbypassphrase
.
the following relevant schema/class/mapping bits:
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 formula
approach above, values read correctly database, nhibernate doesn't try insert/update values when saving database (which makes sense).
the problem able write name
value using corresponding encryptbypassphrase
function. i'm unsure if nhibernate supports this, , if does, haven't been able find correct words search documentation it.
so... how can write computed property database nhibernate?
thanks in advance!
a property mapped formula read-only.
a named query wrapped in contactinfonameupdater service might 1 way solve problem.
- Get link
- X
- Other Apps
Comments
Post a Comment