c# - Nhibernate one-to-many lazy loading not working as expected -


Consider this scenario:

Class A has multiple relationships from class B . There are several relationships for Class C in Class B.

  class A {IList & lt; B & gt; If I load Class B by using a database in some way,  

/ P>

  IList & lt; B & gt; Results = query_list & lt; B & gt; ();  

Everything works as expected,

However if I do something like this:

  separate secrecy query = isolated Characteristics For (typef (a)); Query.CreateAlias ​​("B", "B", JoinType.InnerJoin); IList & lt; A & gt; Results = query_list & lt; A & gt; (); Then, NHibernate will also select from Table C and will load all CS  

Mapping Below: A Mapping ...

  & Lt; Bag name = "blist" table = "b" lazy = "true" reverse = "false" & gt; & Lt; Major column = "id" /> & Lt; One-to-many classes = "b" /> & Lt; / Bag & gt;  

B mapping ...

  & lt; Many-to-one class = "c" name = "CMMM" column = "IDC" lazy = "proxy" external-included = "true" />  

any thoughts? Thank you.

I have created a sample app for testing your landscape and I am not able to reproduce There was a difference between criteria and isolated Syrithia, both of them returned the same result for me

The lazy property was followed or not dependent on external external characteristics, when it is set, then always C gets loaded eagerly, when I remove the external attribute Or, proxy through lazy loading C.

So a potential solution is to change the B mapping as follows:

    

Comments