Permalink
Browse files

prevent race condition where control tries to fetch free text data af…

…ter db connection has closed

bugz: 48622
  • Loading branch information...
1 parent 3f40dab commit e548d459edc9fc538d5fde68b484885e46b3c9a6 @handcraftsman handcraftsman committed Mar 9, 2017
Showing with 3 additions and 15 deletions.
  1. +3 −15 src/FluentWebControls/Mapping/FreeTextMap.cs
@@ -17,22 +17,15 @@ namespace FluentWebControls.Mapping
{
public class FreeTextMap<TDomain> : IFreeTextMap
{
- private readonly Func<TDomain, string> _getValue;
- private readonly TDomain _item;
- private bool _haveValue;
- private string _value;
+ private readonly string _value;
- public FreeTextMap(TDomain item, string id, Func<TDomain, string> getValue)
+ public FreeTextMap(TDomain item, string id, Func<TDomain, string> getValue) : this(id, getValue(item))
{
- Id = id;
- _item = item;
- _getValue = getValue;
}
public FreeTextMap(string id, string value)
{
Id = id;
- _haveValue = true;
_value = value;
}
@@ -43,12 +36,7 @@ public string Value
{
get
{
- if (_haveValue)
- {
- return _value;
- }
- _haveValue = true;
- return _value = _getValue(_item);
+ return _value;
}
}

0 comments on commit e548d45

Please sign in to comment.