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
40e755c
commit ed954ef
Showing
5 changed files
with
89 additions
and
10 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
// 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="ITagHelper"/>'s behavior when its | ||
/// <see cref="ITagHelper.ProcessAsync"/> 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="ITagHelper"/>.</param> | ||
public ContentBehaviorAttribute(ContentBehavior contentBehavior) | ||
{ | ||
ContentBehavior = contentBehavior; | ||
} | ||
|
||
/// <summary> | ||
/// =<see cref="Razor.TagHelpers.ContentBehavior"/> for the <see cref="ITagHelper"/>. | ||
/// </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