Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Move TagHelperBinding out of Legacy.
Browse files Browse the repository at this point in the history
- Added additional properties to the class to make it more production ready.

#1092
  • Loading branch information
NTaylorMullen committed May 8, 2017
1 parent 1705888 commit 2f0ae94
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ public TagHelperBinding GetTagHelperBinding(
return null;
}

var tagMappingResult = new TagHelperBinding(applicableDescriptorMappings);
var tagMappingResult = new TagHelperBinding(
tagName,
attributes,
parentTagName,
applicableDescriptorMappings);

return tagMappingResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,36 @@

using System.Collections.Generic;

namespace Microsoft.AspNetCore.Razor.Language.Legacy
namespace Microsoft.AspNetCore.Razor.Language
{
public sealed class TagHelperBinding
{
public IReadOnlyDictionary<TagHelperDescriptor, IEnumerable<TagMatchingRule>> _mappings;

internal TagHelperBinding(IReadOnlyDictionary<TagHelperDescriptor, IEnumerable<TagMatchingRule>> mappings)
internal TagHelperBinding(
string tagName,
IEnumerable<KeyValuePair<string, string>> attributes,
string parentTagName,
IReadOnlyDictionary<TagHelperDescriptor, IEnumerable<TagMatchingRule>> mappings)
{
TagName = TagName;
Attributes = attributes;
ParentTagName = parentTagName;

_mappings = mappings;
Descriptors = _mappings.Keys;
}

public IEnumerable<TagHelperDescriptor> Descriptors { get; }

public string TagName { get; }

public string ParentTagName { get; }

public IEnumerable<KeyValuePair<string, string>> Attributes { get; }

public string TagHelperPrefix { get; }

public IEnumerable<TagMatchingRule> GetBoundRules(TagHelperDescriptor descriptor)
{
return _mappings[descriptor];
Expand Down

0 comments on commit 2f0ae94

Please sign in to comment.