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);