зеркало из https://github.com/aspnet/Mvc.git
Use nameof when initializing `GeneratedTagHelperContext`
nits: - missing blank line before a comment - cleanup line breaks in `RazorPage.CreateTagHelper`
This commit is contained in:
Родитель
9899cb336a
Коммит
3290791c5f
|
@ -36,6 +36,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
};
|
||||
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
// CodeGenerationContext.DefaultBaseClass is set to MyBaseType<dynamic>.
|
||||
// This field holds the type name without the generic decoration (MyBaseType)
|
||||
private readonly string _baseType;
|
||||
|
@ -85,11 +86,28 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
defineSectionMethodName: "DefineSection",
|
||||
generatedTagHelperContext: new GeneratedTagHelperContext
|
||||
{
|
||||
RunnerTypeName = typeof(TagHelperRunner).FullName,
|
||||
ScopeManagerTypeName = typeof(TagHelperScopeManager).FullName,
|
||||
ExecutionContextTypeName = typeof(TagHelperExecutionContext).FullName,
|
||||
ExecutionContextAddMethodName = nameof(TagHelperExecutionContext.Add),
|
||||
ExecutionContextAddTagHelperAttributeMethodName =
|
||||
nameof(TagHelperExecutionContext.AddTagHelperAttribute),
|
||||
ExecutionContextAddHtmlAttributeMethodName = nameof(TagHelperExecutionContext.AddHtmlAttribute),
|
||||
ExecutionContextOutputPropertyName = nameof(TagHelperExecutionContext.Output),
|
||||
|
||||
RunnerTypeName = typeof(TagHelperRunner).FullName,
|
||||
RunnerRunAsyncMethodName = nameof(TagHelperRunner.RunAsync),
|
||||
|
||||
ScopeManagerTypeName = typeof(TagHelperScopeManager).FullName,
|
||||
ScopeManagerBeginMethodName = nameof(TagHelperScopeManager.Begin),
|
||||
ScopeManagerEndMethodName = nameof(TagHelperScopeManager.End),
|
||||
|
||||
OutputGenerateStartTagMethodName = nameof(TagHelperOutput.GenerateStartTag),
|
||||
OutputGenerateContentMethodName = nameof(TagHelperOutput.GenerateContent),
|
||||
OutputGenerateEndTagMethodName = nameof(TagHelperOutput.GenerateEndTag),
|
||||
|
||||
// Can't use nameof because RazorPage is not accessible here.
|
||||
CreateTagHelperMethodName = "CreateTagHelper",
|
||||
StartWritingScopeMethodName = "StartWritingScope",
|
||||
EndWritingScopeMethodName = "EndWritingScope"
|
||||
EndWritingScopeMethodName = "EndWritingScope",
|
||||
})
|
||||
{
|
||||
ResolveUrlMethodName = "Href",
|
||||
|
|
|
@ -138,8 +138,8 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
public TTagHelper CreateTagHelper<TTagHelper>() where TTagHelper : ITagHelper
|
||||
{
|
||||
var tagHelper = TypeActivator.CreateInstance<TTagHelper>(ViewContext.HttpContext.RequestServices);
|
||||
var hasViewContext = tagHelper as ICanHasViewContext;
|
||||
|
||||
var hasViewContext = tagHelper as ICanHasViewContext;
|
||||
hasViewContext?.Contextualize(ViewContext);
|
||||
|
||||
return tagHelper;
|
||||
|
|
Загрузка…
Ссылка в новой задаче