From 00c38fca591564e1200a39856475a8d7573f182c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 3 Mar 2017 17:27:39 -0800 Subject: [PATCH] Add ModelState to Page --- src/Microsoft.AspNetCore.Mvc.RazorPages/Page.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Page.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Page.cs index b043ba8e18..0007c2d3e5 100644 --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Page.cs +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Page.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; +using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure; using Microsoft.AspNetCore.Mvc.ViewFeatures; @@ -18,10 +19,13 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages private PageArgumentBinder _binder; /// - /// The . + /// The . /// public PageContext PageContext { get; set; } + /// + /// Gets or sets the . + /// public PageArgumentBinder Binder { get @@ -45,6 +49,11 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages } } + /// + /// Gets the . + /// + public ModelStateDictionary ModelState => PageContext?.ModelState; + /// /// Gets the from the . /// @@ -57,6 +66,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages throw new NotSupportedException(); } + /// public override void BeginContext(int position, int length, bool isLiteral) { const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext"; @@ -76,6 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages } } + /// public override void EndContext() { const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext";