Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Query Error Not Working #861

Closed
mdhthahmd opened this issue Oct 20, 2020 · 5 comments
Closed

Include Query Error Not Working #861

mdhthahmd opened this issue Oct 20, 2020 · 5 comments

Comments

@mdhthahmd
Copy link

mdhthahmd commented Oct 20, 2020

Hi, i am trying to implement many-to-many and one-to-many relationships in this library, so i followed the code samples and documentation but i am unable to get the include query working,
For example when i ran the provided example project which has the many-to-many relationship between Articles and Tags,
GET /articles works and return the correct response, while GET /articles?include=tags return 500 error.
It looks like any resource that has to many relationship does not work, with the provided example and documentation. So what is the intended way of implementing to-many relationships?

@bart-degreed
Copy link
Contributor

Hi @mdhthahmd, which version of JsonApiDotNetCore are you using? I'm asking because it should work. We have various usages in tests, for example here.

Assuming you're using a recent 4.x prerelease version, it would help to include the error message you're getting (with stack trace) or post some code to reproduce the problem.

@mdhthahmd
Copy link
Author

Hi @bart-degreed, i just cloned the repo and got started today, so current master/main branch.
Ok, i will provide the error message soon

@bart-degreed
Copy link
Contributor

bart-degreed commented Oct 20, 2020

I've verified this on master and you're correct this does not work. Unfortunately it is caused by a bug in EF Core. You can help us by upvoting that issue.

As a workaround, you can disable paging:

options.DefaultPageSize = null;

in JsonApiDotNetCoreExample.Startup.ConfigureJsonApiOptions method.

That makes the request succeed, but still fails when paging at both levels is explicitly asked for:

GET http://localhost:14140/api/v1/articles/?include=tags&page[size]=1,tags:1 HTTP/1.1

@mdhthahmd
Copy link
Author

mdhthahmd commented Oct 21, 2020

Hi @bart-degreed , the work around options.DefaultPageSize = null; do return a proper response, but the include is missing of the response and data of the root resource is empty.

Include query is not working as intended either way

@mdhthahmd
Copy link
Author

Ok, i finally found out the cause, i was using sqlite and the error is reproducible, when i switched to sqlserver the feature works as intended, so i am geussing this has something to do with sqlite provider for efcore @bart-degreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants