diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs
index 4c26a8d1ba..b897eb580e 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/OptionTagHelper.cs
@@ -55,7 +55,7 @@ public override int Order
///
///
/// Does nothing unless contains a
- /// entry and that entry is a non-empty
+ /// entry and that entry is a non-empty
/// instance. Also does nothing if the associated <option> is already
/// selected.
///
@@ -82,9 +82,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
{
// Is this element a child of a element the SelectTagHelper targeted?
object formDataEntry;
- context.Items.TryGetValue(
- SelectTagHelper.SelectedValuesFormDataKey,
- out formDataEntry);
+ context.Items.TryGetValue(typeof(SelectTagHelper), out formDataEntry);
// ... And did the SelectTagHelper determine any selected values?
var selectedValues = formDataEntry as ICollection;
diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs
index b364ff4cce..61d5ae13a8 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/SelectTagHelper.cs
@@ -22,16 +22,6 @@ public class SelectTagHelper : TagHelper
private const string ForAttributeName = "asp-for";
private const string ItemsAttributeName = "asp-items";
- ///
- /// Key used for selected values in .
- ///
- ///
- /// Value for this dictionary entry will either be null (indicating no has
- /// executed within this <form/>) or an instance. Elements of the
- /// collection are based on current .
- ///
- public static readonly string SelectedValuesFormDataKey = nameof(SelectTagHelper) + "-SelectedValues";
-
///
/// Creates a new .
///
@@ -131,7 +121,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
// Whether or not (not being highly unlikely) we generate anything, could update contained
// elements. Provide selected values for tag helpers. They'll run next.
- context.Items[SelectedValuesFormDataKey] = currentValues;
+ context.Items[typeof(SelectTagHelper)] = currentValues;
}
}
}
\ No newline at end of file
diff --git a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/OptionTagHelperTest.cs b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/OptionTagHelperTest.cs
index 5d33162111..b4829d14c0 100644
--- a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/OptionTagHelperTest.cs
+++ b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/OptionTagHelperTest.cs
@@ -420,7 +420,7 @@ public async Task ProcessAsync_GeneratesExpectedOutput(
model: null,
htmlGenerator: htmlGenerator,
metadataProvider: metadataProvider);
- tagHelperContext.Items[SelectTagHelper.SelectedValuesFormDataKey] = selectedValues;
+ tagHelperContext.Items[typeof(SelectTagHelper)] = selectedValues;
var tagHelper = new OptionTagHelper(htmlGenerator)
{
Value = value,
@@ -491,7 +491,7 @@ public async Task ProcessAsync_DoesNotUseGenerator_IfSelectedNullOrNoSelectedVal
model: null,
htmlGenerator: htmlGenerator,
metadataProvider: metadataProvider);
- tagHelperContext.Items[SelectTagHelper.SelectedValuesFormDataKey] = selectedValues;
+ tagHelperContext.Items[typeof(SelectTagHelper)] = selectedValues;
var tagHelper = new OptionTagHelper(htmlGenerator)
{
Value = value,
diff --git a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/SelectTagHelperTest.cs b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/SelectTagHelperTest.cs
index 4e777fc25b..c5af6c0039 100644
--- a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/SelectTagHelperTest.cs
+++ b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/SelectTagHelperTest.cs
@@ -247,7 +247,7 @@ public async Task ProcessAsync_GeneratesExpectedOutput(
Assert.Single(
tagHelperContext.Items,
- entry => (string)entry.Key == SelectTagHelper.SelectedValuesFormDataKey);
+ entry => (Type)entry.Key == typeof(SelectTagHelper));
}
[Theory]
@@ -344,7 +344,7 @@ public async Task ProcessAsync_WithItems_GeneratesExpectedOutput_DoesNotChangeSe
Assert.Single(
tagHelperContext.Items,
- entry => (string)entry.Key == SelectTagHelper.SelectedValuesFormDataKey);
+ entry => (Type)entry.Key == typeof(SelectTagHelper));
Assert.Equal(savedDisabled, items.Select(item => item.Disabled));
Assert.Equal(savedGroup, items.Select(item => item.Group));
@@ -448,7 +448,7 @@ public async Task ProcessAsyncInTemplate_WithItems_GeneratesExpectedOutput_DoesN
Assert.Single(
tagHelperContext.Items,
- entry => (string)entry.Key == SelectTagHelper.SelectedValuesFormDataKey);
+ entry => (Type)entry.Key == typeof(SelectTagHelper));
Assert.Equal(savedDisabled, items.Select(item => item.Disabled));
Assert.Equal(savedGroup, items.Select(item => item.Group));
@@ -540,7 +540,7 @@ public async Task ProcessAsync_CallsGeneratorWithExpectedValues_ItemsAndAttribut
var keyValuePair = Assert.Single(
tagHelperContext.Items,
- entry => (string)entry.Key == SelectTagHelper.SelectedValuesFormDataKey);
+ entry => (Type)entry.Key == typeof(SelectTagHelper));
Assert.Same(currentValues, keyValuePair.Value);
}
@@ -613,7 +613,7 @@ public async Task TagHelper_CallsGeneratorWithExpectedValues_RealModelType(
var keyValuePair = Assert.Single(
tagHelperContext.Items,
- entry => (string)entry.Key == SelectTagHelper.SelectedValuesFormDataKey);
+ entry => (Type)entry.Key == typeof(SelectTagHelper));
Assert.Same(currentValues, keyValuePair.Value);
}