3
3
4
4
using System ;
5
5
using System . Diagnostics ;
6
+ using Microsoft . AspNetCore . Mvc . ModelBinding ;
6
7
using Microsoft . AspNetCore . Mvc . Razor ;
7
8
using Microsoft . AspNetCore . Mvc . RazorPages . Infrastructure ;
8
9
using Microsoft . AspNetCore . Mvc . ViewFeatures ;
@@ -18,10 +19,13 @@ public abstract class Page : RazorPageBase, IRazorPage
18
19
private PageArgumentBinder _binder ;
19
20
20
21
/// <summary>
21
- /// The <see cref="PageContext"/>.
22
+ /// The <see cref="RazorPages. PageContext"/>.
22
23
/// </summary>
23
24
public PageContext PageContext { get ; set ; }
24
25
26
+ /// <summary>
27
+ /// Gets or sets the <see cref="PageArgumentBinder"/>.
28
+ /// </summary>
25
29
public PageArgumentBinder Binder
26
30
{
27
31
get
@@ -45,6 +49,11 @@ public PageArgumentBinder Binder
45
49
}
46
50
}
47
51
52
+ /// <summary>
53
+ /// Gets the <see cref="ModelStateDictionary"/>.
54
+ /// </summary>
55
+ public ModelStateDictionary ModelState => PageContext ? . ModelState ;
56
+
48
57
/// <summary>
49
58
/// Gets the <see cref="ITempDataDictionary"/> from the <see cref="PageContext"/>.
50
59
/// </summary>
@@ -57,6 +66,7 @@ public override void EnsureRenderedBodyOrSections()
57
66
throw new NotSupportedException ( ) ;
58
67
}
59
68
69
+ /// <inheritdoc />
60
70
public override void BeginContext ( int position , int length , bool isLiteral )
61
71
{
62
72
const string BeginContextEvent = "Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext" ;
@@ -76,6 +86,7 @@ public override void BeginContext(int position, int length, bool isLiteral)
76
86
}
77
87
}
78
88
89
+ /// <inheritdoc />
79
90
public override void EndContext ( )
80
91
{
81
92
const string EndContextEvent = "Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext" ;
0 commit comments