Add ModelState to Page
This commit is contained in:
parent
145d27f9b3
commit
00c38fca59
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
using Microsoft.AspNetCore.Mvc.Razor;
|
using Microsoft.AspNetCore.Mvc.Razor;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
|
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||||
|
|
@ -18,10 +19,13 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
|
||||||
private PageArgumentBinder _binder;
|
private PageArgumentBinder _binder;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="PageContext"/>.
|
/// The <see cref="RazorPages.PageContext"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PageContext PageContext { get; set; }
|
public PageContext PageContext { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the <see cref="PageArgumentBinder"/>.
|
||||||
|
/// </summary>
|
||||||
public PageArgumentBinder Binder
|
public PageArgumentBinder Binder
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -45,6 +49,11 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the <see cref="ModelStateDictionary"/>.
|
||||||
|
/// </summary>
|
||||||
|
public ModelStateDictionary ModelState => PageContext?.ModelState;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="ITempDataDictionary"/> from the <see cref="PageContext"/>.
|
/// Gets the <see cref="ITempDataDictionary"/> from the <see cref="PageContext"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -57,6 +66,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override void BeginContext(int position, int length, bool isLiteral)
|
public override void BeginContext(int position, int length, bool isLiteral)
|
||||||
{
|
{
|
||||||
const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext";
|
const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext";
|
||||||
|
|
@ -76,6 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override void EndContext()
|
public override void EndContext()
|
||||||
{
|
{
|
||||||
const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext";
|
const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue