This repository was archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ContentBehaviorAttribute for TagHelpers.
- Added detection of custom ContentBehaviors via the ContentBehaviorAttribute in the TagHelperDescriptorFactory. - Updated some comments in the ContentBehavior enum. - Add tests to validate custom content behavior resolution. #122
- Loading branch information
1 parent
41e44b3
commit 55b4148
Showing
5 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/Microsoft.AspNet.Razor.Runtime/TagHelpers/ContentBehaviorAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using Microsoft.AspNet.Razor.TagHelpers; | ||
|
||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers | ||
{ | ||
/// <summary> | ||
/// Used to override <see cref="TagHelper"/>s functionality for when its | ||
/// <see cref="TagHelper.Process(TagHelperOutput, TagHelperContext)"/> or | ||
/// <see cref="TagHelper.ProcessAsync(TagHelperOutput, TagHelperContext)"/> is invoked. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] | ||
public sealed class ContentBehaviorAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Instantiates a new instance of the <see cref="ContentBehaviorAttribute"/> class. | ||
/// </summary> | ||
/// <param name="contentBehavior">The <see cref="Razor.TagHelpers.ContentBehavior"/> for the | ||
/// <see cref="TagHelper"/> to use.</param> | ||
public ContentBehaviorAttribute(ContentBehavior contentBehavior) | ||
{ | ||
ContentBehavior = contentBehavior; | ||
} | ||
|
||
/// <summary> | ||
/// A <see cref="Razor.TagHelpers.ContentBehavior"/> for the <see cref="TagHelper"/> to follow. | ||
/// </summary> | ||
public ContentBehavior ContentBehavior { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters