Delay initialization in .NET – NHIBERNATE

If the relationship between one entity and another entity is mapped as Lazy = False, but for a certain function I need to get them in Lazily, is it possible to do it at runtime?
No, you can’t. As the commenter pointed out, you can map it to lazily and eagerly, But not the other way around.

That is, in LINQ, you can use Fetch / FetchMany / ThenFetch / ThenFetchMany to get the relationship eagerly:

session. Query()
.Where(x => x.Name == "Ruba")
.FetchMany(x => x.Children)
.ThenFetch(x => x .SomethingMore);

If the relationship between one entity and another entity is mapped as Lazy = False, but for a certain function I need to get them in Lazily, it may be in Does it happen at runtime?

No, you can’t. As the commenter pointed out, you can map it to lazily and eagerly, but not the other way around.

< p>That is, in LINQ, you can use Fetch / FetchMany / ThenFetch / ThenFetchMany to get the relationship eagerly:

session.Query()
.Where (x => x.Name == "Ruba")
.FetchMany(x => x.Children)
.ThenFetch(x => x.SomethingMore);

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 467 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.