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

Async odata endpoint not returning edm model #390

Closed
andrew-vdb opened this issue Nov 23, 2021 · 4 comments · Fixed by #988
Closed

Async odata endpoint not returning edm model #390

andrew-vdb opened this issue Nov 23, 2021 · 4 comments · Fixed by #988
Assignees

Comments

@andrew-vdb
Copy link

Actual:
The setup use EDM model,
when we use IQueryable, the db call will be done synchronously and return EDM model
when we use IAsyncEnumerable, the db call will be done async and return simple model..
Expected:
when we use IAsyncEnumerable, the db call will be done async and should return EDM model..

//This return EDM model
[HttpGet("odata/students")]
        [EnableQuery]
        public IQueryable<Model.Student> OData()
        {
            return _context.Students;
        }

//This NOT return EDM model
        [HttpGet("odata/students")]
        [EnableQuery]
        public IAsyncEnumerable<Model.Student> OData()
        {
            return _context.Students.AsAsyncEnumerable();
        }
@andrew-vdb
Copy link
Author

This is not supported

[HttpGet("odata/students")]
        [EnableQuery]
        public IAsyncQueryable<Model.Student> OData()
        {
            return _context.Students.AsAsyncEnumerable().AsAsyncQueryable();
        }

@xuzhg
Copy link
Member

xuzhg commented Nov 23, 2021

Could be similar to OData/WebApi#2598

@andrew-vdb
Copy link
Author

Just tested with EnableQueryAsync in another issue...

https://localhost:7040/odata/students?$count=true&$top=2

The select top will run async
The select count will run sync
and it will return edm data as expected

@jr01
Copy link

jr01 commented Nov 25, 2021

See this issue for count async in [EnableQueryAsync] OData/WebApi#2325

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

Successfully merging a pull request may close this issue.

5 participants