Skip to content

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

Open
xuzhg wants to merge 1 commit intorelease-8.xfrom
issue1250
Open

Fixes #1250: Enable query options on untyped properties#1270
xuzhg wants to merge 1 commit intorelease-8.xfrom
issue1250

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