Querying single types by id partially fails when using Dataloader
See original GitHub issueFirst thanks for this awesome project. And let’s come to my weird issue.
Describe the Issue When I try to query single entities from my ef core context using the CacheDataloader the query fails randomly a couple of times and then magically works. This issue only appears when I try to query different entities at a time.
To Reproduce Steps to reproduce the behavior:
- Create an EF Core Context with an Entity
- Add the Context to asp dependencies using AddDbContext
- Add a query to Schema
- Query to single entities by id in one query
Code I have this inside my RootQuery Schema
// User
descriptor.Field("user")
.Argument("id", a => a.Type<NonNullType<IntType>>())
.Type<UserType>()
.Resolver( async ctx =>
{
var userId = ctx.Argument<int>("id");
var data = await ctx.CacheDataLoader<int, User>("userById",
id => ctx.Service<PanelContext>().Users.AsNoTracking()
.FirstOrDefaultAsync(u => u.Id == userId)).LoadAsync(userId);
return data;
});
descriptor.Field("app")
.Argument("id", a => a.Type<NonNullType<IntType>>())
.Type<AppType>()
.Resolver( async ctx =>
{
var appId = ctx.Argument<int>("id");
var data = await ctx.CacheDataLoader<int, App>("appById",
id => ctx.Service<PanelContext>().Apps.AsNoTracking()
.FirstOrDefaultAsync(a => a.Id == appId)).LoadAsync(appId);
return data;
});
Here is a gif of this: https://imgur.com/pLumz9N
Not sure what is causing this.
Regards Artur
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
Querying single types by id partially fails when using ...
When I try to query single entities from my ef core context using the CacheDataloader the query fails randomly a couple of times...
Read more >Query regarding Partial loads (through data loader or ...
Query regarding Partial loads (through data loader or Database.insert with false paramater) with error record.
Read more >"INVALID CROSS REFERENCE ID" IN DATALOADER
I am trying to do upsert through data loader.It is throwing the following error for all rows in the csv file.The ids used...
Read more >Errors due to invalid IDs during Data Loader import and ...
Users may encounter the following errors when working in Data Loader: MALFORMED_ID: Object name id: id value of incorrect type.
Read more >All about Upsert and External ID in Dataloader and Apex
If any one record will fail then none of contact record will be upserted. You may want to perform partial operation where if...
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 FreeTop 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
Top GitHub Comments
Excellent, I’m looking forward to it! Hot Chocolate and Strawberry Shake rock!
This is now solved with the upcoming resource concept in 10.4