Skip to content

Commit 77df9f0

Browse files
authored
Update ASP.NET Core 3.1-to-5.0 migration guide for RC2 (#20217)
1 parent 1c02145 commit 77df9f0

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

aspnetcore/migration/31-to-50.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: scottaddie
44
description: Learn how to migrate an ASP.NET Core 3.1 project to ASP.NET Core 5.0.
55
ms.author: scaddie
66
ms.custom: mvc
7-
ms.date: 09/14/2020
7+
ms.date: 10/16/2020
88
no-loc: ["ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
99
uid: migration/31-to-50
1010
---
@@ -41,7 +41,7 @@ If you rely upon a [global.json](/dotnet/core/tools/global-json) file to target
4141
{
4242
"sdk": {
4343
- "version": "3.1.200"
44-
+ "version": "5.0.100-rc.1.20452.10"
44+
+ "version": "5.0.100-rc.2.20479.15"
4545
}
4646
}
4747
```
@@ -100,9 +100,9 @@ In the project file, update each [Microsoft.AspNetCore.*](https://www.nuget.org/
100100
- <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.1.6" />
101101
- <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.6" />
102102
- <PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
103-
+ <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.0-rc.1.*" />
104-
+ <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0-rc.1.*" />
105-
+ <PackageReference Include="System.Net.Http.Json" Version="5.0.0-rc.1.*" />
103+
+ <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.0-rc.2.*" />
104+
+ <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0-rc.2.*" />
105+
+ <PackageReference Include="System.Net.Http.Json" Version="5.0.0-rc.2.*" />
106106
</ItemGroup>
107107
```
108108

@@ -117,27 +117,35 @@ For apps using Docker, update your *Dockerfile* `FROM` statements and scripts. U
117117

118118
As part of the move to ".NET" as the product name, the Docker images moved from the `mcr.microsoft.com/dotnet/core` repositories to `mcr.microsoft.com/dotnet`. For more information, see [dotnet/dotnet-docker#1939](https://github.com/dotnet/dotnet-docker/issues/1939).
119119

120-
## Review breaking changes
121-
122-
For breaking changes from .NET Core 3.1 to .NET 5.0, see [Breaking changes for migration from version 3.1 to 5.0](/dotnet/core/compatibility/3.1-5.0). ASP.NET Core and Entity Framework Core are also included in the list.
123-
124-
## Changes to model binding in ASP.NET Core MVC and Razor Pages
120+
## Model binding changes in ASP.NET Core MVC and Razor Pages
125121

126122
### DateTime values are model bound as UTC times
127123

128-
In ASP.NET Core 3.1 and earlier, `DateTime` values were model bound as local time where the timezone was determined by the server. `DateTime` values bound from input formatting (JSON) and `DateTimeOffset` values were bound as UTC timezones. In ASP.NET Core 5.0 and later, model binding consistently binds `DateTime` values with the UTC timezone.
124+
In ASP.NET Core 3.1 and earlier, `DateTime` values were model-bound as local time, where the timezone was determined by the server. `DateTime` values bound from input formatting (JSON) and `DateTimeOffset` values were bound as UTC timezones.
125+
126+
In ASP.NET Core 5.0 and later, model binding consistently binds `DateTime` values with the UTC timezone.
129127

130-
To retain the previous behavior, remove the `DateTimeModelBinderProvider` as part of the application startup:
128+
To retain the previous behavior, remove the `DateTimeModelBinderProvider` in `Startup.ConfigureServices`:
131129

132130
```csharp
133-
services.AddControllersWithViews(options => options.ModelBinderProviders.RemoveType<DateTimeModelBinderProvider>());
131+
services.AddControllersWithViews(options =>
132+
options.ModelBinderProviders.RemoveType<DateTimeModelBinderProvider>());
134133
```
135134

136-
### ComplexObjectModelBinderProvider \ ComplexObjectModelBinder replace ComplexTypeModelBinderProvider \ ComplexTypeModelBinder
135+
### ComplexObjectModelBinderProvider \ ComplexObjectModelBinder replace ComplexTypeModelBinderProvider \ ComplexTypeModelBinder
136+
137+
To add support for model binding [C# 9 record types](/dotnet/csharp/whats-new/csharp-9#record-types), the <xref:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexTypeModelBinderProvider> is:
137138

138-
As part of adding support for model binding record types, the `ComplexTypeModelBinderProvider` is annotated as obsolete and is no longer registered by default. Applications that previously relied on the presence of the `ComplexTypeModelBinderProvider` in the `ModelBinderProviders` collection need to be updated to reference the new binder provider:
139+
* Annotated as obsolete.
140+
* No longer registered by default.
141+
142+
Apps that rely on the presence of the `ComplexTypeModelBinderProvider` in the `ModelBinderProviders` collection need to reference the new binder provider:
139143

140144
```diff
141145
- var complexModelBinderProvider = options.ModelBinderProviders.OfType<ComplexTypeModelBinderProvider>();
142146
+ var complexModelBinderProvider = options.ModelBinderProviders.OfType<ComplexObjectModelBinderProvider>();
143147
```
148+
149+
## Review breaking changes
150+
151+
For breaking changes from .NET Core 3.1 to .NET 5.0, see [Breaking changes for migration from version 3.1 to 5.0](/dotnet/core/compatibility/3.1-5.0). ASP.NET Core and Entity Framework Core are also included in the list.

0 commit comments

Comments
 (0)