Expose `IsTagHelper` as an extensibility point.

- This is required for the Razor tooling that determines `TagHelperDescriptor`s.

https://github.com/aspnet/RazorTooling/issues/43
This commit is contained in:
N. Taylor Mullen 2016-01-28 11:18:00 -08:00
parent 18909506e1
commit f78c52a216
1 changed files with 12 additions and 2 deletions

View File

@ -83,9 +83,19 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers
return assembly.ExportedTypes.Select(type => type.GetTypeInfo());
}
// Internal for testing.
internal virtual bool IsTagHelper(TypeInfo typeInfo)
/// <summary>
/// Indicates if a <see cref="TypeInfo"/> should be treated as a tag helper.
/// </summary>
/// <param name="typeInfo">The <see cref="TypeInfo"/> to inspect.</param>
/// <returns><c>true</c> if <paramref name="typeInfo"/> should be treated as a tag helper;
/// <c>false</c> otherwise</returns>
protected virtual bool IsTagHelper(TypeInfo typeInfo)
{
if (typeInfo == null)
{
throw new ArgumentNullException(nameof(typeInfo));
}
return
!typeInfo.IsNested &&
typeInfo.IsPublic &&