{"id":5629,"date":"2024-04-26T11:38:00","date_gmt":"2024-04-26T18:38:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/odata\/?p=5629"},"modified":"2024-04-26T12:32:54","modified_gmt":"2024-04-26T19:32:54","slug":"odata-net-8-preview-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/odata\/odata-net-8-preview-release\/","title":{"rendered":"OData .NET 8 Preview Release"},"content":{"rendered":"<p>We would like to announce that we are planning a new major release of OData .NET core libraries in June. Ahead of this release, we have released preview versions of the libraries to get some early feedback from the community. Specifically, the following preview releases are now available on NuGet:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.OData.Core\/8.0.0-preview.1\">Microsoft.OData.Core 8.0.0-preview.1<\/a><\/li>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.OData.Edm\/8.0.0-preview.1\">Microsoft.OData.Edm 8.0.0-preview.1<\/a><\/li>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.OData.Client\/8.0.0-preview.1\">Microsoft.OData.Client 8.0.0-preview.1<\/a><\/li>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Spatial\/8.0.0-preview.1\">Microsoft.Spatial 8.0.0-preview.1<\/a><\/li>\n<\/ul>\n<p>It has been almost 8 years since the last major release of OData .NET core libraries. This release presents an opportunity for us to modernize our stack, address some technical debt and take better advantage of investments in .NET. To make adoption and upgrading to the new version smooth, we have opted to limit the number of breaking changes. In many cases, you should be able to upgrade to the new release by changing the version number with minimal code changes. We share a list of breaking changes below.<\/p>\n<p>The most disruptive change we are making in this release is dropping support for .NET Framework. The new release will only support .NET 8 and later. We understand that there are still a lot of people using .NET Framework. For this reason, we will continue to maintain OData .NET v7 suite of libraries for the foreseeable future. We currently have no plans to drop support for OData Core 7.x. We will eventually stop adding new features after the 8.0 major release.<\/p>\n<p>With this release, we will also introduce an official support policy. The support policy will document the support lifecycle for the different official OData libraries. This will state which versions are supported and for how long and this should help customers plan their migration accordingly. We will also publish a comprehensive migration guide to help you move from version 7.x to 8.0.0.<\/p>\n<p>We invite you to try out these new versions and share feedback with us. Feel free to create an <a href=\"https:\/\/github.com\/OData\/odata.net\/issues\">issue on our GitHub repository<\/a> if you run into any issues with the preview release.<\/p>\n<h2>OData .NET 8 release schedule<\/h2>\n<ul>\n<li>April 26th, 2024: First preview release 8.0.0-preview.1<\/li>\n<li>May 16th, 2024: First release candidate 8.0.0-rc1<\/li>\n<li>June 20th, 2024: Official release 8.0.0<\/li>\n<\/ul>\n<p>We may release additional preview versions or release candidates before the final release depending on the feedback we get. We also plan to release new versions of Microsoft.AspNetCore.OData and Microsoft.OData.ModelBuilder that take advantage of OData Core 8.x. We will communicate the dates for these releases soon.<\/p>\n<h2>Breaking changes in Version 8.0.0-preview.1<\/h2>\n<p>The sections below list the breaking changes introduced the preview release. For a full list of changes (including non-breaking changes and improvements), <a href=\"https:\/\/learn.microsoft.com\/en-us\/odata\/changelog\/odatalib-8x\">check the changelog<\/a>.<\/p>\n<h3>General breaking changes<\/h3>\n<ul>\n<li>Support for .NET 8 and later only: We dropped support for .NET Framework, NET Core 3.1 and lower, .NET 7 and lower.<\/li>\n<\/ul>\n<h3>Breaking changes in <code>Microsoft.OData.Core<\/code><\/h3>\n<ul>\n<li>Merged <code>IJsonWriter<\/code>,<code>IJsonWriterAsync<\/code>, <code>IJsonStreamWriter<\/code>, <code>IJsonStreamWriterAsync<\/code> into a single interface <code>IJsonWriter<\/code> that exposes synchronous, asynchronous and streaming APIs for writing JSON payloads<\/li>\n<li>Merged <code>IJsonReader<\/code>, <code>IJsonReaderAsync<\/code>, <code>IJsonStreamReader<\/code>, <code>IJsonStreamReaderAsync<\/code> into a single interface <code>IJsonReader<\/code> that exposes synchronous, asynchronous and streaming APIs for reading JSON payloads<\/li>\n<li>Changed the default value of the <code>leaveOpen<\/code> argument of the <code>ODataBinaryStreamValue<\/code> constructor from <code>true<\/code> to <code>false<\/code>. This means that by default, when the <code>ODataBinaryStreamValue<\/code> object is disposed, the underlying stream will also be closed and disposed.<\/li>\n<li>JSONP support has been deprecated and will be removed in Microsoft.OData.Core 9.<\/li>\n<li>The <code>IJsonWriterFactory.CreateJsonWriter<\/code> method now accepts a <code>Stream<\/code> instead of a <code>TextWriter<\/code>.<\/li>\n<li>The <code>DefaultStreamBasedJsonWriterFactory<\/code> class has been renamed to <code>ODataUtf8JsonWriterFactory<\/code>.<\/li>\n<li>Remove our custom <code>IContainerBuilder<\/code> interface used for dependency injection in favor of the standard<a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/core\/extensions\/dependency-injection-usage\"> Microsoft.Extensions.DependencyInjection<\/a> APIs.<\/li>\n<li>Introduced a new extension method called <code>AddDefaultODataServices<\/code>to <code>IServiceCollection<\/code> for registering default OData services.<\/li>\n<li>Removed the <code>ODataSimplifiedOptions<\/code> class and moved its properties to more appropriate classes (see below).<\/li>\n<li>Moved <code>EnableParsingKeyAsSegment<\/code> from <code>ODataSimplifiedOptions<\/code> to <code>ODataUriParserSettings<\/code>.<\/li>\n<li>Moved <code class=\"notranslate\">EnableReadingKeyAsSegment<\/code>\u00a0and\u00a0<code class=\"notranslate\">EnableReadingODataAnnotationPrefix<\/code> from <code>ODataSimplifiedOptions<\/code> to <code class=\"notranslate\">ODataMessageReaderSettings.<\/code><\/li>\n<li>Moved <code class=\"notranslate\">EnableWritingKeyAsSegment<\/code>,\u00a0<code class=\"notranslate\">GetOmitODataPrefix<\/code>\u00a0and\u00a0<code class=\"notranslate\">SetOmitODataPrefix<\/code> from <code>ODataSimplifiedOptions<\/code> to <code class=\"notranslate\">ODataMessageWriterSettings<\/code>.<\/li>\n<li>Removed the <code>ODataMessageReader.CreateODataDeltaReader<\/code> and <code>CreateODataDeltaReaderAsync<\/code> methods. Use <code>CreateODataDeltaResourceSetReader<\/code> instead.<\/li>\n<li>Removed the <code>ODataMessageWriter.CreateODataDeltaWriter<\/code> and <code>CreateODataDeltaWriterAsync<\/code> methods. Use <code>CreateODataDeltaResourceSetWriterAsync<\/code> instead.<\/li>\n<li>Added the <code>INavigationSourceSegment<\/code> interface that exposes a <code>NavigationSource<\/code> property to provide a consistent way of retrieving the navigation source without having to perform a type cast.<\/li>\n<\/ul>\n<h3>Breaking changes in <code>Microsoft.OData.Client<\/code><\/h3>\n<ul>\n<li>Marked the <code>DataServiceContext.KeyComparisonGeneratesFilterQuery<\/code> property as deprecated and changed the default value from <code>false<\/code> to <code>true<\/code>. This means that the LINQ query <code>context.People.Where(p =&gt; p.Id == 10)<\/code> will generate a URL filter query option like <code>\/People?$filter=Id eq 10<\/code> instead of <code>\/People(10)<\/code> by default.<\/li>\n<li>Removed <code>HttpWebRequestMessage<\/code> class, and consequently, support for the legacy <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.net.httpwebrequest\"><code>HttpWebRequest<\/code><\/a> API. All requests from the client will be made using <code>HttpClientRequestMessage<\/code> which is based on <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.net.http.httprequestmessage\"><code>HttpRequestMessage<\/code> <\/a>and <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.net.http.httpclient\"><code>HttpClient<\/code><\/a>.<\/li>\n<li>Removed the <code>HttpRequestTransportMode<\/code> enum property from <code>DataServiceContext<\/code>. This property was used to switch between <code>HttpClient<\/code> and <code>HttpWebRequest<\/code>. Now all requests are made using <code>HttpClient<\/code>.<\/li>\n<li>Added <code>DataServiceContext.HttpClientFactory<\/code> property that allows you inject your <code>HttpClient<\/code> instance by passing a custom <code>IHttpClientFactory<\/code>. This replaces the previous approach of configuring a http client using the custom <code>IHttpClientHandlerProvider<\/code> (see below).<\/li>\n<li>Removed the <code>DataServiceContext.HttpClientHandleProvider<\/code> property and the <code>IHttpClientHandlerProvider<\/code> interface. These were used to provide custom <code>HttpClient<\/code> configurations. The <code>DataServiceContext.HttpClientFactory<\/code> should be used instead.<\/li>\n<li>Removed the <code>DataServiceContext.Credentials<\/code> property. The <code>DataServiceContext.HttpClientFactory<\/code> should be used to provide a <code>HttpClient<\/code> instance configured with the right credentials if needed.<\/li>\n<li>Removed the <code>HttpClientRequestMessage.ReadWriteTimeout<\/code> property. The <code>HttpClientRequestMessage.Timeout<\/code> can be used to set the request timeout.<\/li>\n<li>Removed the <code>DataServiceQuery&lt;TElement&gt;.IncludeTotalCount(bool countQuery)<\/code> method. Use <code>IncludeCount(bool countQuery)<\/code> instead.<\/li>\n<li>Removed the <code>DataServiceQuery&lt;TElement&gt;.IncludeTotalCount()<\/code> method. Use <code>DataServiceQuery&lt;TElement&gt;.IncludeCount()<\/code> instead.<\/li>\n<li>Removed the <code>QueryOperationResponse.TotalCount<\/code> property. Use <code>Count<\/code> instead.<\/li>\n<\/ul>\n<h3>Breaking changes in <code>Microsoft.OData.Edm<\/code><\/h3>\n<ul>\n<li>Added the <code>EntityType<\/code> property to <code>IEdmNavigationSource<\/code> interface to make it easier to retrieve the entity type from a navigation source without having to perform a type cast.<\/li>\n<\/ul>\n<h2>Planned changes in Version 8.0.0<\/h2>\n<p>This section contains a list of planned changes that are expected to make it to the official 8.0.0 release that are not available in the first preview.<\/p>\n<h3>Planned changes in <code>Microsoft.OData.Core<\/code><\/h3>\n<ul>\n<li>Make <code>ODataUtf8JsonWriter<\/code> the default JSON writer implementation.<\/li>\n<li>Use <code>ValueTask&lt;T&gt;<\/code> instead of <code>Task&lt;T&gt;<\/code> for async I\/O operations where applicable.<\/li>\n<li>Allow customers to include custom annotations in the payload that are not included in the <code>include-odata-annotations<\/code> preference header.<\/li>\n<li>When writing the <code>Scale<\/code> attribute in XML CSDL, write <code>variable<\/code> in lowercase instead of <code>Variable<\/code>.<\/li>\n<li>Change the <code>ODataLibraryCompatibility<\/code> enum into a flags enum where each bit will represent a different compatibility setting that can be used to enable some legacy serializaiton behaviour.<\/li>\n<li>Remove deprecated APIs and behavior flags.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We would like to announce that we are planning a new major release of OData .NET core libraries in June. Ahead of this release, we have released preview versions of the libraries to get some early feedback from the community. Specifically, the following preview releases are now available on NuGet: Microsoft.OData.Core 8.0.0-preview.1 Microsoft.OData.Edm 8.0.0-preview.1 Microsoft.OData.Client [&hellip;]<\/p>\n","protected":false},"author":20326,"featured_media":3253,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5629","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-odata"],"acf":[],"blog_post_summary":"<p>We would like to announce that we are planning a new major release of OData .NET core libraries in June. Ahead of this release, we have released preview versions of the libraries to get some early feedback from the community. Specifically, the following preview releases are now available on NuGet: Microsoft.OData.Core 8.0.0-preview.1 Microsoft.OData.Edm 8.0.0-preview.1 Microsoft.OData.Client [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/5629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/users\/20326"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/comments?post=5629"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/5629\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/media\/3253"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/media?parent=5629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/categories?post=5629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/tags?post=5629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}