I used nhibernate serialized configuration objects (also discussed here and here ) to speed up the launch of my application from about 8 s to 1 s. I also use fluent-nhibernate, so the path is more like
- ClassMap class definitions in code
- fluentconfiguration
- XML
- Nhibernate configuration
- configuration serialized to disk.
The problem is that there is a risk of obsolete mappings - if I change the mappings, but forget to rebuild the serialized configuration, then in the end I use the old mappings without realizing it. This does not always lead to an immediate and obvious error during testing, and several times incorrect behavior was a real pain to detect and fix.
Does anyone know how I can determine if my class maps have changed so that I can either immediately trigger a warning / error, or rebuild it upon request?
I am currently comparing timestamps on my compiled assembly against a serialized configuration. This will lead to changes in the pickup settings, but, unfortunately, it generates a massive false-positive rate, since ANY code changes lead to an outdated sign. I cannot move classes to another assembly because they are tightly integrated into business logic.
This time pushed me away, so I was wondering if anyone has any suggestions?
source
share