Hi all,
I am looking to obfuscate a data access layer which is written using NHibernate. The problem is, the mappings are done in XML files which are embedded as resources in the class library - which means the mapping are in clear text.
Two potential solutions are to use: 1. Nhibernate Mapping attributes (NHMA) to decorat ethe entities mapped (so, when the obfuscated code runs, NHibernate will map it to the obfuscated class names) 2. Fluent NHibernate (again, the mapping is in code, so obfuscation should not be a problem - I think).
Now, both these solutions will not work if we use HQL to do the queries - since the queries would refer to the original class and field/property names!
Is there a solution for this? Can we have class/property names aliased in NHMA/Fluent mappings?
Will the Criteria API help somehow if we convert the HQL queries to use the NHibernate Criteria API?
(I do know the benefits and disadvantages/futility of obfuscation and the purpose it is useful for - so this question is not meant to discuss that at all. In other words, please dont worry about discussing 'why' I want to do this!)
Thanks,
Krishna.