eager-loading Questions

2

Consider following entity model: public class Parent { public virtual FirstChild FirstChild { get; set; } public virtual SecondChild SecondChild { get; set; } } In my code, I have loaded Paren...
Leitman asked 12/3, 2015 at 15:33

3

I have a table of restaurants that have many reservations. Now I would like to query all restaurants and in case they have reservations for 2 people it should preload these associations. In case th...
Tosch asked 8/1, 2017 at 11:59

2

Solved

I use Entity framework 6. I have a Transaction object with several navigation properties. It is easy to implement eager loading using multiple Include. var aa = db.Transactions.Include(p => p.A...
To asked 24/8, 2020 at 17:16

3

Solved

My application uses Entity Framework 7 and the repository pattern. The GetById method on the repository supports eager loading of child entities: public virtual TEntity GetById(int id, params Expre...

1

I will try to simplify the problem as much as I can. I want to disable a relation load from a trait on a resource that happens at the retrieved event. There is a model we will name Post that uses a...
Concinnous asked 1/2, 2023 at 11:54

3

I'm trying to select only certain columns using eager_load, but I'm facing the problem that it cancels my 'select'. Model: class Timeline < ActiveRecord::Base belongs_to :timeline_category, f...
Cytogenesis asked 20/6, 2016 at 13:37

8

Solved

I've got a Hibernate object which's properties are all loaded lazy. Most of these properties are other Hibernate objects or PersistentSets. Now I want to force Hibernate to eager load these proper...
Corrinacorrine asked 14/10, 2010 at 10:32

5

Solved

What laravel says: $books = App\Book::with('author.contacts')->get(); What I need is something like this $books = App\Book::with('author[contacts,publishers]')->get(); where we eager lo...
Inwardness asked 18/2, 2016 at 19:30

4

Solved

I have a simple problem, but cant seem to find a way around it. I am using Entity Framework Core version 2.0.1 and want to eager load all my entities by default. Example: public class Order { pu...
Pruter asked 31/3, 2018 at 23:40

10

Solved

The Include() method works quite well for Lists on objects. But what if I need to go two levels deep? For example, the method below will return ApplicationServers with the included properties shown...
Crowned asked 30/5, 2012 at 19:7

1

Laravel Version: 5.5 PHP Version: 7+ Database Driver & Version: mysql 5.7+ Scenario: I have a SaaS application that has flexible database structure, so its fields are bound to change, espec...
Chandra asked 26/11, 2017 at 19:46

2

I have the model that has relation to itself like this public function children() { return $this->hasMany(AppointmentPart::class,'parent_id'); } I want to eager loading for queries for this ...
Chloroform asked 30/9, 2019 at 7:43

1

Using Symfony 3.2 and Doctrine 2.5, I have trouble to understand how fetch "EAGER" should work in many-to-many and many-to-one relationship. Lets say we have two entities, User and Site, and a man...
Dissolute asked 5/6, 2017 at 17:10

2

Solved

class Taak : [Key] public int TaakId { get; set; } public int Pid { get; private set; } [Required] [Range(0,23.5)] public double Uur { get; private set; } [Required] public Functie Funct...
Rabblerouser asked 14/12, 2020 at 19:49

2

Solved

I have some models like those below: public class Mutant { public long Id { get; set; } ... // Relations public long OriginalCodeId { get; set; } public virtual OriginalCode OriginalCode { g...
User asked 19/2, 2017 at 13:3

4

Solved

I have the following models in my application: User.php <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class User extends Model { public function customer_details() { ...
Lampoon asked 22/9, 2015 at 21:14

3

Solved

When querying a DbContext with eager loading, it is required to Include("Navigation") in order to populate Navigation Properties. However on some occasions I would like to simply Include all naviga...
Prefigure asked 12/2, 2015 at 16:38

4

Solved

i have four model Tehsil, Ilr, Patwar, and Villages. and their association is Tehsil -> 1:m -> Ilr -> 1:m -> Patwar -> 1:m -> Villages i want to to apply order by on all four of my models. Query...
Subtenant asked 23/10, 2016 at 11:47

3

Solved

I have a Notifications model that belongs to a User. I want to load the user when a collection of notifications is selected and only load the model with names and emails. However, when using the se...
Thithia asked 31/5, 2018 at 11:16

3

Solved

I have Banks table and separate table with services $bank = Banks::find(1); echo $bank->service(1); // print bank with that service (serviceId 1) It is posible to eager load all banks with s...
Wrongly asked 25/12, 2014 at 7:3

1

Solved

Class User < ActiveRecord::Base has_many :posts, dependent: :destroy end Class Post < ActiveRecord::Base belongs_to :user end When a User having N posts is destroyed, N+1 queries are run ...

1

I want to scale separately some subparts of my rails app and avoid loading the whole codebase. For the sake of example, let's consider an APIv1 vs an APIv2, but I'd also want to extend this any cl...
Varicella asked 24/5, 2017 at 10:47

1

Solved

I have two entities Dept and Emp (real case changed and minimized). There is 1:n association between them, i.e. properties Dept.empList and Emp.dept exist with respective annotations. I want to get...
Lookthrough asked 24/6, 2020 at 11:42

4

It seems to me that fragment caching and eager loading are -- at least sometimes -- somewhat at odds with each other. Let's say I have a User who has many posts which each has many comments which i...
Fighterbomber asked 20/4, 2014 at 8:28

3

Solved

We have a few apps that are currently using an EF model that has lazy-loading enabled. When I turn off the lazy-loading (to avoid implicit loads and most of our N+1 selects), I'd much rather have a...

© 2022 - 2024 — McMap. All rights reserved.