eager-loading
Fighting cartesian product (x-join) when using NHibernate 3.0.0
Ok, I wrote an example for myself reflecting your structure and this should work: int projectId = 1; // replace that with the id you want // required for the joins in QueryOver Project pAlias = null; Partner paAlias = null; PartnerCosts pcAlias = null; Address aAlias = null; Money mAlias = null; // Query … Read more
Entity Framework Core 2.0.1 Eager Loading on all nested related entities
Such feature officially does not exist currently (EF Core 2.0.2 and also the incoming 2.1). It’s been requested in Eager load all navigation properties #4851(Closed) and currently is tracked by Rule-based eager load (include) #2953 and Allow for declaring aggregates in the model (e.g. defining included properties or by some other means) #1985 (both in … Read more
EF Core returns null relations until direct access
The reason is explained in the Loading Related Data section of the EF Core documentation. The first behavior is because EF Core currently does not support lazy loading, so normally you’ll get null for navigation properties until you specifically load them via eager or explicit loading. However, the Eager loading section contains the following: Tip … Read more
Laravel – Eager Loading Polymorphic Relation’s Related Models
Solution: It is possible, if you add: protected $with = [‘company’]; to both the Service and Product models. That way, the company relation is eager-loaded every time a Service or a Product is loaded, including when loaded via the polymorphic relation with History. Explanation: This will result in an additional 2 queries, one for Service … Read more
How do I eagerly Include the child and grandchild elements of an entity in Entity Framework Code First?
Also, it isn’t necessary to use the string overload. This method will work too: var customers = db.Customers.Include(c => c.Books.Select(b => b.Author)); For more examples see the EF team blog post: http://blogs.msdn.com/b/adonet/archive/2011/01/31/using-dbcontext-in-ef-feature-ctp5-part-6-loading-related-entities.aspx And this tutorial: http://www.asp.net/entity-framework/tutorials/reading-related-data-with-the-entity-framework-in-an-asp-net-mvc-application
Fetch vs FetchMany in NHibernate Linq provider
Fetch should be used for references and FetchMany for collections. This is particularly important because only FetchMany can be combined with ThenFetchMany to fetch “grandchildren” collections. Example: session.Query<User>() .FetchMany(u => u.Orders) .ThenFetchMany(o => o.OrderItems)
How to Determine if Rails Association is Eager Loaded?
Use .association(name).loaded? on a record. For Rails < 3.1 use loaded_foo?. (It is deprecated since Rails 3.1. See: https://github.com/rails/rails/issues/472.)
Laravel Eloquent: eager loading of multiple nested relationships
You can do $books = App\Book::with(‘author.contacts’,’author.publishers’)->get();
Eloquent eager load Order by
Try this: Student::with(array(‘exam’ => function($query) { $query->orderBy(‘result’, ‘DESC’); })) ->get();