Skip to content

Commit

Permalink
Merge in 'release/6.0' changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnet-bot committed Jan 10, 2022
2 parents 6ffe8df + 2bd9de6 commit 04a113d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
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,13 +15,12 @@ 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,16 +86,10 @@ 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

0 comments on commit 04a113d

Please sign in to comment.