Hey all,

I got a huge issue with nHibernate that makes me almost crazy. Concerning 
the code beneath: When I first run the code, everything works fine. But 
invoking the call again, the constructor of RegistryEntry is still being 
invoked by the value of "number" of the first invocation (0). 

 
             private int number = 0;
 
             private Collections.RegistryEntryColl InternalEntries {
                    get {
                           if (_entries == null) {
                                  var query = 
Session.Instances<Persistence.RegistryEntry>();
                                  var topLevelEntries = query.Where(e => 
e.Parent == null);
 
                                  var session = Session;
 
                                  var list = topLevelEntries;
                                  var number = number++;
 
                                  _entries = new 
Collections.RegistryEntryColl(list
                                        .Select(e => new 
RegistryEntry(session, number, e)));
                           }
 
                           return _entries;
                    }
             }


I found out that the problem doesn't appear if I declare the variable 
number as static. But this can't be it. Can anyone please help me? Any 
ideas? Would be so thankful!

Kind regards
Rom

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/9XBicdZtGzYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to