1
- // Licensed to the .NET Foundation under one or more agreements.
1
+ // Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
4
using System ;
@@ -249,6 +249,7 @@ private static void ConfigureDictionaryBoundAttribute(
249
249
bool hasPublicSetter )
250
250
{
251
251
string ? dictionaryAttributePrefix = null ;
252
+ var dictionaryAttributePrefixSet = false ;
252
253
253
254
if ( attributeNameAttribute != null )
254
255
{
@@ -257,6 +258,7 @@ private static void ConfigureDictionaryBoundAttribute(
257
258
if ( name == TagHelperTypes . HtmlAttributeName . DictionaryAttributePrefix )
258
259
{
259
260
dictionaryAttributePrefix = ( string ? ) argument . Value ;
261
+ dictionaryAttributePrefixSet = true ;
260
262
break ;
261
263
}
262
264
}
@@ -266,7 +268,7 @@ private static void ConfigureDictionaryBoundAttribute(
266
268
267
269
if ( ! dictionaryTypeArguments . IsEmpty )
268
270
{
269
- var prefix = attributeNameAttribute is null || dictionaryAttributePrefix is null
271
+ var prefix = attributeNameAttribute is null || ! dictionaryAttributePrefixSet
270
272
? attributeName + "-"
271
273
: dictionaryAttributePrefix ;
272
274
@@ -291,7 +293,7 @@ private static void ConfigureDictionaryBoundAttribute(
291
293
return ;
292
294
}
293
295
294
- if ( ! hasPublicSetter && attributeNameAttribute != null && dictionaryAttributePrefix == null )
296
+ if ( ! hasPublicSetter && attributeNameAttribute != null && ! dictionaryAttributePrefixSet )
295
297
{
296
298
// Must set DictionaryAttributePrefix when using HtmlAttributeNameAttribute with a dictionary property
297
299
// that lacks a public setter.
0 commit comments