Closed
Description
openedon Oct 13, 2021
We are migrating our 5.0 project to 6.0-rc2 and noticed that RazorPage.Model was changed to always be nullable, even though model type in razor file is specified as not null. Because of this, we are getting thousands of compile time errors on any model access outside of asp-for
expressions like asp-route-id="@Model.Id"
.
Describe the solution you'd like
Would it be possible to change it to TModel
from TModel?
?
So we can tell the razor page if model is possibly null or not in the view?
@model MyModel?
Additional context
My guess is that razor doesn't parse nullable models in views, so it wasn't made that way because of that?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment