populate against existing entities
See original GitHub issueWhen writing business logic that is something like:
processChildren(children: Child[]): Promise<void> {
await Promise.all(children.map(async child => {
const parent = await child.parent.load()
});
});
I’ve got an N+1 loading the parent
for each child. I’d like to do something like populate: { parent }
but that only works if I’m the one who loaded the children / i.e. called find
.
Would it be easy/possible to add a populate
method directly to EntityManager
, i.e.:
em.populate(children, ["parent"]);
?
Or is there an existing/better way to do this that I’m missing?
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Populate an existing entity from a new data source
Populate an existing entity from a new data source · Create new Integration and Source content packs. · Use the existing Target entity...
Read more >Entity Framework: Populate existing object instance
The closest you'll be able to get is to use DbEntityEntry.Reload on your entity object, followed by using the DbEntityEntry.Reference and DbEntityEntry.
Read more >Smart Nested Populate
To populate existing entities, you can use em.populate() . const authors = await em.
Read more >Data Integration. How to load into existing entity
We use SQL server data source through data gateway. I can query my on-prem dataset and would like to load my list if...
Read more >Auto-Populate fields on new entities from multiple...
You can try field mapping / relationship mapping.. but in relationship mapping you can populate only from one entity and datatype/ length of ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t want to change the
EntityLoader
signature now (BC), but we can add that new method to EM that would work like this.This is great, thanks @B4nan !