public void SetProperty(int?instanceNumber, string keyName, string propertyName, PropertyValue propertyValue) { this.locker.WithWriteLock(delegate() { this.SetStats(instanceNumber); KeyContainer container = this.FindContainer(keyName, true); this.SetPropertyInternal(container, propertyName, propertyValue.Clone()); }); }
private static List <PropertyValue> ParseValuesFromMultivalueString(PropertyValue firstPropertyValue, string additionalDelimiter) { var result = new List <PropertyValue>(); var multivalue = firstPropertyValue.Value?.ToString(); var chars = new[] { ",", additionalDelimiter }; var valueArray = multivalue?.Split(chars, StringSplitOptions.RemoveEmptyEntries) .Select(x => x.Trim()) .Where(x => !string.IsNullOrEmpty(x)) .Distinct() .ToArray(); foreach (var singleValue in valueArray ?? Array.Empty <string>()) { var valueClone = firstPropertyValue.Clone() as PropertyValue; valueClone.Value = singleValue; result.Add(valueClone); } return(result); }
public PropertyValue GetProperty(string keyName, string propertyName) { PropertyValue propertyValue = null; this.locker.WithReadLock(delegate() { ExTraceGlobals.StoreReadTracer.TraceDebug <string, string, string>((long)this.identityHash, "{0}: Entering GetProperty - Key: {1} PropertyName: {2}", this.identity, keyName, propertyName); KeyContainer keyContainer = this.FindContainer(keyName, false); if (keyContainer != null) { keyContainer.Properties.TryGetValue(propertyName, out propertyValue); } ExTraceGlobals.StoreReadTracer.TraceDebug <string, bool>((long)this.identityHash, "{0}: Exiting GetProperty - IsFound {1}", this.identity, propertyValue != null); }); if (propertyValue != null) { propertyValue = propertyValue.Clone(); } return(propertyValue); }