Skip to content

Conversation

@ElizabethOkerio
Copy link
Contributor

@ElizabethOkerio ElizabethOkerio commented Jul 2, 2024

This PR fixes: OData/odata.net#3004 and OData/odata.net#3009.

It sets the MaxProtocolVersion to have the same version as the OData-Version. Currently, V4 is set as the default Protocol Version. If someone uses the V401 OData-Version, the MaxProtocolVersion is not updated which causes exceptions. Even setting OData-MaxVersion does not fix this problem.

@gathogojr
Copy link
Contributor

This PR fixes: OData/odata.net#3004 and OData/odata.net#3009.

It sets the MaxProtocolVersion to have the same version as the OData-Version. Currently, V4 is set as the default Protocol Version. If someone uses the V401 OData-Version, the MaxProtocolVersion is not updated which causes exceptions. Even setting OData-MaxVersion does not fix this problem.

@ElizabethOkerio If ODataMessageReaderSettings.Version is set to V4, should ODataMessageReaderSettings.MaxProtocolVersion be set to V401 or V4?

@ElizabethOkerio
Copy link
Contributor Author

ElizabethOkerio commented Jul 2, 2024

This PR fixes: OData/odata.net#3004 and OData/odata.net#3009.
It sets the MaxProtocolVersion to have the same version as the OData-Version. Currently, V4 is set as the default Protocol Version. If someone uses the V401 OData-Version, the MaxProtocolVersion is not updated which causes exceptions. Even setting OData-MaxVersion does not fix this problem.

@ElizabethOkerio If ODataMessageReaderSettings.Version is set to V4, should ODataMessageReaderSettings.MaxProtocolVersion be set to V401 or V4?

This is what happens from ODL.

if (odataVersion < ODataVersion.V401)
{
    Validations = ValidationKinds.All;
    this.ReadUntypedAsString = true;
    this.MaxProtocolVersion = ODataConstants.ODataDefaultProtocolVersion;
    this.EnableReadingODataAnnotationWithoutPrefix = false;
}
else
{
    Validations = ValidationKinds.All & ~ValidationKinds.ThrowOnUndeclaredPropertyForNonOpenType;
    this.ReadUntypedAsString = false;
    this.MaxProtocolVersion = odataVersion;
    this.EnableReadingODataAnnotationWithoutPrefix = true;
}

Should we update this from ODL to make sure the MaxProtocolVersion is always equal to the highest OData Version.

As an alternative, users can pass custom instances of the ODataMessageReaderSettings to the DI container with the updated MaxProtocolVersion

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.

OData.Client DataServiceContext BulkUpdate() Always Uses Protocol Version 4.01

2 participants