I ran into an issue with NHibernate 1.2.0GA when trying to use an explict interface for property access using NHibernate. It is very important that developers not set the values of our properties explicitly one of our internal structures. This is used for some of our value types which need additional information besides just the value. We do not want users assigning values to our structure, but rather should assign a new structure instantiated using a constructor.
To accomodate NHiberante (given the initial implementation was in 1.0.3) we created an interface for NHibernate, set the properties of the interface to Obsolete() and then implemented them explicitly on our structures. This then meant that only through reflection could a developer possibly set the value directly, and we so far at least trust developers not to blatantly violate our policy on setting the value by using reflection.
With NHibernate 1.2.0.GA when we try to save the structure we receive one of a few exceptions. Either we get a complaint that the memory was corrupt or we would see that there was a EngingeExecutionException thrown reporting a possible bug in the framework.
I changed the configuration options for the reflection optimizer to false and everything works just fine. I assume there is some sort of bug in the reflection optimizer where it does not work properly for explicit interface implementations.
|