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

Can't return Task<List<Guid>> in controller #9

Closed
darius-khll opened this issue Dec 11, 2016 · 4 comments
Closed

Can't return Task<List<Guid>> in controller #9

darius-khll opened this issue Dec 11, 2016 · 4 comments
Assignees

Comments

@darius-khll
Copy link
Contributor

consider the following code

        [Function]
        [Parameter("categoryId", typeof(Guid))]
        public virtual async Task<Guid[]> GetlocationIdsByCategoryId([FromODataUri]Guid categoryId, CancellationToken cancellationToken)
        {
            return await _categoryInLocationsRepository.GetAll().Where(c => c.ProductCategoryId == categoryId).Select(c => c.LocationId).ToArrayAsync(cancellationToken);
        }

above code makes these error
Build:Type 'string' does not satisfy the constraint 'Entity'.

@ysmoradi
Copy link
Member

Based on my tests, and based on line 147 of sample jaydata code located in https://github.com/jaystack/odata4-webapi-endpoint/blob/development/WebApi_2_2_OData_4/client/JayDataContext.js which is
SFunction1: { type: $data.ServiceFunction, returnType: 'Edm.String', params: [{ name: 'number', type: 'Edm.Int32' }] }
We've no real problem with this at runtime. There is a small problem with jaydata defenitions. We've to remove T extends Entity generic constraint from $data.Queryable of jaydata in line 56 of jaydata.d.ts @Alikhll Could you please do this in https://github.com/bit-foundation/jaydata/blob/development/jaydata.d.ts and then report the test results here?

@ysmoradi
Copy link
Member

There is a problem with string[] (or any [] like types) in code generator, I'm gonna fix that. But There might be no other problem with List, IEnumerable, IQueryable etc.

@darius-khll
Copy link
Contributor Author

darius-khll commented Dec 12, 2016

it seems changing the generic T could solve this issue, thanks bro

darius-khll added a commit to darius-khll/jaydata that referenced this issue Dec 12, 2016
darius-khll added a commit to ysmoradi/jaydata that referenced this issue Dec 12, 2016
@lock
Copy link

lock bot commented Sep 10, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.

@lock lock bot added the outdated label Sep 10, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants