Replies: 1 comment 1 reply
-
Lazy loading causes the entities to be loaded as proxies, in other word, as a subclass dynamically generated by NHibernate. So, if your test compare an instance your code has instantiated with a loaded one, they will not have the same class, so the serialization ordering of properties might change. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
In some test projects where we use
NHibernate
/FluentNHibernate
to map our domain model and using Verify to assert changes, we sometimes get inconsistent ordering of properties in the output. I created an issue in the Verify github repo: VerifyTests/Verify#1396, but I'm wondering if this is more of anNHibernate
issue. The problem we experience is that the order of properties change sometimes and it seems it's when it happens, it's usually properties that are lazy loaded the might change place. This is a bit of a problem when using a serialized test framework like verify because it causes tests to become flaky. Here's an example from our build server which has generated a different output than on our development machines:... so basically I'm wondering if this is something that could be caused by NHibernate lazy loading? ...and if so, is there something to do about it, any settings that can be changed to make property ordering deterministic, aside from using
NHibernateUtil.Initialize
to ensure all lazy loaded entities have been loaded before asserting the object?Beta Was this translation helpful? Give feedback.
All reactions