The site I am working on is mostly secure data entry and I am using the following workflow:
I am wondering if it is possible to set nHibernate to decode all text fields before sending them to SQL without having to manually decode every single text field. I would like to do this because the reports I generate in SQL contain the encoding and is unreadable.
Again, I am looking for some sort of global setting for nHiberate to decode all text fields before sending them to SQL.
Or perhaps a way to decode before generating the report?
Does anyone have any ideas?
You could create a custom type that encode/decode when you set/get the property. You'll need to derive from IUserType and register your type with NHibernate. Here's an example en encrypted string
https://gist.github.com/jasondentler/1170933#file-encryptedstring-cs
Alternatively you could write EventListeners and do your encode/decode there.
Here's the documentation on EventListeners
http://nhibernate.info/doc/nhibernate-reference/events.html
If I were you I'd go down the Custom type route. It's less code to maintain and is more of what you are looking for.