From 3ca5b81d5226c0c458352ed1c60998ab2b41756b Mon Sep 17 00:00:00 2001 From: Sam Xu Date: Wed, 25 Jan 2023 18:12:25 -0800 Subject: [PATCH] fixes #2601: AddDefaultODataServices should pass OData version to low layer (#2602) * fixes #2601: AddDefaultODataServices should pass OData version to lower layer * Update src/Microsoft.OData.Core/ContainerBuilderExtensions.cs Co-authored-by: John Gathogo Co-authored-by: John Gathogo --- src/Microsoft.OData.Core/ContainerBuilderExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OData.Core/ContainerBuilderExtensions.cs b/src/Microsoft.OData.Core/ContainerBuilderExtensions.cs index 9d7a20916e..07615a2191 100644 --- a/src/Microsoft.OData.Core/ContainerBuilderExtensions.cs +++ b/src/Microsoft.OData.Core/ContainerBuilderExtensions.cs @@ -136,9 +136,9 @@ public static IContainerBuilder AddDefaultODataServices(this IContainerBuilder b builder.AddService(ServiceLifetime.Singleton, sp => new DefaultJsonWriterFactory()); builder.AddService(ServiceLifetime.Singleton, sp => ODataMediaTypeResolver.GetMediaTypeResolver(null)); builder.AddService(ServiceLifetime.Scoped); - builder.AddServicePrototype(new ODataMessageReaderSettings()); + builder.AddServicePrototype(new ODataMessageReaderSettings(odataVersion)); builder.AddService(ServiceLifetime.Scoped, sp => sp.GetServicePrototype().Clone()); - builder.AddServicePrototype(new ODataMessageWriterSettings()); + builder.AddServicePrototype(new ODataMessageWriterSettings { Version = odataVersion }); builder.AddService(ServiceLifetime.Scoped, sp => sp.GetServicePrototype().Clone()); builder.AddService(ServiceLifetime.Singleton, sp => ODataPayloadValueConverter.GetPayloadValueConverter(null)); builder.AddService(ServiceLifetime.Singleton, sp => EdmCoreModel.Instance);