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

For an Odata API the DataMember name is not reflecting in the API response #2443

Closed
Vasumithra23 opened this issue Mar 22, 2021 · 3 comments · Fixed by OData/AspNetCoreOData#980
Assignees

Comments

@Vasumithra23
Copy link

Hi,

I have a C# class called students.cs with the below property:

[DataMember(Name = "dept_no")]
public byte DeptNo { get; set; }

The problem is that I am getting DeptNo instead of dept_no in the API response.If I disable the pagesize its working fine else not. Can you help me with this issue?

Thanks.

@xuzhg
Copy link
Member

xuzhg commented Mar 22, 2021

@Vasumithra23 Do you have [DataContract] on your C# class? to be clear, DataMember works closely with [DataContract].

You mentioned "disable pagesize" makes it working. Can you share more codes related about it?

@Vasumithra23
Copy link
Author

Vasumithra23 commented Mar 23, 2021

Hi @xuzhg

Yes ,I have used [DataContract] in C# class.

I have used EnableQuery in my controller, which is as follows:
//[EnableQuery(EnableCorrelatedSubqueryBuffering = true)]// without pagesize its working fine
//[EnableQuery(EnableCorrelatedSubqueryBuffering = true,PageSize =100)]// with pagesize its not giving desired output (i.e dept_no)

Could you help me with this issue?

Thanks.

@Vasumithra23
Copy link
Author

Vasumithra23 commented Mar 24, 2021

@xuzhg Can you help me with this issue?

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

Successfully merging a pull request may close this issue.

2 participants