0
votes

All,

1

Please confirm but I observed today that the default setting for fetching collections at least is: Lazy = false (which is opposite of NHibernate). i.e. when you don't specify Lazy on your HasMany() attr, the collections are fetched immediately.

2

Another question: I have specified on my Order Entity referencing the Customer entity BelongsTo(Lazy = FetchWhen.OnInvoke), that setting is not honored, I get my customers eagerly fetched when I get the orders. What's going on there? Why are the customers fetched eagerly for all returned orders? After tinkering, when I add lazy on the Customer Entity itself (ActiveRecord(Lazy = true)), the Lazy setting on BelongsTo() works as expected. Therefore, it looks like the BelongsTo(Lazy = FetchWhen.OnInvoke) is ONLY honored when the referenced entity has explicitly enabled lazy loading via (ActiveRecord(Lazy = true)).

3

Is there a way in the castle active record config file to set global setting for Lazy = true for all entities?

1

1 Answers

0
votes

@1 Confirmed

@2 If I remember correctly you have to set [BelongsTo(..., Lazy = FetchWhen.OnInvoke, Fetch = FetchEnum.Select)] then even [ActiveRecord(..., Lazy = true)] should be loaded as you want.

Greetings Juy Juka