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

Fixes #1250: Enable query options on untyped properties #1270

Open
wants to merge 1 commit into
base: release-8.x
Choose a base branch
from

Conversation

xuzhg
Copy link
Member

@xuzhg xuzhg commented Jul 1, 2024

Treat the System.Object as EdmUntypedStructuredType
Treat EdmUntypedStructuredType as System.Object
Add test to cover the $filter, $select on untyped properties
Not covered the $orderby on untyped properties

@habbes habbes self-requested a review September 25, 2024 04:52
@habbes
Copy link
Contributor

habbes commented Sep 25, 2024

@xuzhg tests are failing:

[xUnit.net 00:00:04.5725114]     Microsoft.AspNetCore.OData.Tests.Formatter.Serialization.ODataDeltaResourceSetSerializerTests.WriteObjectAsync_Calls_WriteObjectInlineAsync [FAIL]
  Failed Microsoft.AspNetCore.OData.Tests.Formatter.Serialization.ODataDeltaResourceSetSerializerTests.WriteObjectAsync_Calls_WriteObjectInlineAsync [4 ms]
  Error Message:
   System.Runtime.Serialization.SerializationException : ODataDeltaResourceSetSerializer cannot write an object of type 'Edm.Untyped'.
  Stack Trace:
     at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataDeltaResourceSetSerializer.GetResourceType(IEdmTypeReference feedType) in D:\a\_work\1\s\src\Microsoft.AspNetCore.OData\Formatter\Serialization\ODataDeltaResourceSetSerializer.cs:line 415
   at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataDeltaResourceSetSerializer.WriteObjectAsync(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext) in D:\a\_work\1\s\src\Microsoft.AspNetCore.OData\Formatter\Serialization\ODataDeltaResourceSetSerializer.cs:line 67
   at Microsoft.AspNetCore.OData.Tests.Formatter.Serialization.ODataDeltaResourceSetSerializerTests.WriteObjectAsync_Calls_WriteObjectInlineAsync() in D:\a\_work\1\s\test\Microsoft.AspNetCore.OData.Tests\Formatter\Serialization\ODataDeltaResourceSetSerializerTests.cs:line 152
--- End of stack trace from previous location where exception was thrown ---
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]

Comment on lines +204 to +211
if (isNullable)
{
return EdmUntypedStructuredTypeReference.NullableTypeReference;
}
else
{
return EdmUntypedStructuredTypeReference.NonNullableTypeReference;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xuzhg Do you have tests for both scenarios here?

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 this pull request may close these issues.

3 participants