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
Ignoring Dictionary properties are not working #157
Comments
@komdil Your route goes into non-odata routing. It means your "GetEdmModel()" doesn't be called. Did you register any OData route? From the call stack, it calls I have a test for your issue, see 2c04d26 Use my sample, it works {"@odata.context":"http://localhost:5000/odata/$metadata#Student","value":[{"Id":"abc","Name":"Zhangg","Score":8},{"Id":"efg","Name":"Jingchan","Score":8},{"Id":"xyz","Name":"Hollewye","Score":8}]} |
@xuzhg I didn't understand the solution. Can you explain? It is not working on me. |
I am getting this error on patching entity also. Here is call stack:
|
@xuzhg Another way to reproduce this problem:
It is working fine when my query is https://localhost:44383/Student/9DCC39C7-754C-4002-8627-BD719AA13E73 System.ArgumentException: Found more than one dynamic property container in type 'Student'. Each open type must have at most one dynamic property container. (Parameter 'propertyInfo') HEADERSConnection: keep-alive Here is my project source code: https://github.com/komdil/ODataCoreTest/tree/dynamicPropertyIssue |
In this case, you should check the ModelState in the There's an error showing that Of course, it's up to you without checking the model state. But, it's better to do model state check in every action. By the way, if you do want it to work. you can add one line code as: public IActionResult Get(Guid key)
{
Request.ODataFeature().Model = Startup.GetEdmModel();
var student = CreateNewStudentWithGuid("Cody Allen", 130);
return Ok(student);
} You can get: But, this is not my solution for you to do it. |
@xuzhg As you can see, parameter is not |
Excuse me, i am confusing. Your code is "Guid key", not string key. |
@xuzhg Look here please. Also I pushed new changes on https://github.com/komdil/ODataCoreTest/tree/dynamicPropertyIssue |
@komdil Actually, That's not related to the type of parameter in Get() action, that's related to Edm type of student "id" property. If you send ~/$metadata, you can see it's a Edm.Guid type. If it's a string type, the formatter for string type is "singe quote" + content + "single quote". So, I assume even you change as "string key" in Get() method, it still can't work. |
@xuzhg Here is my meta data:
As you can it has alternetive key. It was working in previos version. Now it is not working even with valid string: https://localhost:44383/Student(Name='Cody Allen') |
@komdil Oh, now, I see. Unfortunately, It's not implemented for the alternate key in conventional or attribute routing in 8.0. |
@xuzhg Is there any workarround ? |
Let me test it tomorrow and see whether I can raise the priority for alternate key. |
I have two classes:
My configuartion:
I am getting error on https://localhost:44383/odata/Student
There should not be this error because I ignored dictionaries
The text was updated successfully, but these errors were encountered: