Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Mvc/Mvc.Razor/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
*REMOVED*Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>.Model.get -> TModel?
Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>.Model.get -> TModel
3 changes: 1 addition & 2 deletions src/Mvc/Mvc.Razor/src/RazorPageOfT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ public abstract class RazorPage<TModel> : RazorPage
/// <summary>
/// Gets the Model property of the <see cref="ViewData"/> property.
/// </summary>
public TModel? Model => ViewData == null ? default(TModel) : ViewData.Model;
public TModel Model => ViewData.Model;

/// <summary>
/// Gets or sets the dictionary for view data.
/// </summary>
[RazorInject]
public ViewDataDictionary<TModel> ViewData { get; set; } = default!;

}
2 changes: 2 additions & 0 deletions src/Mvc/Mvc.ViewFeatures/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
*REMOVED*Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<TModel>.Model.get -> TModel?
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<TModel>.Model.get -> TModel
12 changes: 3 additions & 9 deletions src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,9 @@ internal ViewDataDictionary(IModelMetadataProvider metadataProvider)
}

/// <inheritdoc />
public new TModel? Model
public new TModel Model
{
get
{
return (base.Model == null) ? default(TModel) : (TModel)base.Model;
}
set
{
base.Model = value;
}
get => (base.Model is null) ? default! : (TModel)base.Model;
set => base.Model = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model?.ShowRequestId ?? false)
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model?.RequestId</code>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

Expand Down