@@ -18,9 +18,8 @@ namespace Geta.Optimizely.GenericLinks;
1818
1919public abstract class LinkData : ILinkData
2020{
21- private readonly IDictionary < string , string > _attributes ;
22- private readonly IDictionary < string , string > _attributeKeys ;
23- private readonly object _pessimisticLock ;
21+ private readonly Dictionary < string , string > _attributes ;
22+ private readonly Dictionary < string , string > _attributeKeys ;
2423
2524 private bool _isModified ;
2625 private bool _isReadOnly ;
@@ -30,7 +29,6 @@ protected LinkData()
3029 {
3130 _attributes = new Dictionary < string , string > ( 4 ) ;
3231 _attributeKeys = new Dictionary < string , string > ( 4 ) ;
33- _pessimisticLock = new object ( ) ;
3432 }
3533
3634 [ Display ( Order = 100 ) ]
@@ -73,6 +71,8 @@ public virtual string? Href
7371 }
7472
7573 [ ScaffoldColumn ( false ) ]
74+ [ SystemTextJsonIgnore ]
75+ [ NewtonsoftJsonIgnore ]
7676 public virtual IDictionary < string , string > Attributes => _attributes ;
7777
7878 [ Ignore ]
@@ -163,6 +163,9 @@ public virtual object Clone()
163163 //
164164 // Value:
165165 // true if this property is read only; otherwise, false.
166+
167+ [ SystemTextJsonIgnore ]
168+ [ NewtonsoftJsonIgnore ]
166169 public bool IsReadOnly
167170 {
168171 get
@@ -321,15 +324,9 @@ protected virtual string GetAttributeKey(string key)
321324 if ( _attributeKeys . TryGetValue ( key , out var attributeKey ) )
322325 return attributeKey ;
323326
324- lock ( _pessimisticLock )
325- {
326- if ( _attributeKeys . ContainsKey ( key ) )
327- return _attributeKeys [ key ] ;
328-
329- attributeKey = key . ToCamel ( ) ;
330- _attributeKeys . Add ( key , attributeKey ) ;
327+ attributeKey = key . ToCamel ( ) ;
328+ _attributeKeys . TryAdd ( key , attributeKey ) ;
331329
332- return attributeKey ;
333- }
330+ return attributeKey ;
334331 }
335332}
0 commit comments