/// <summary>
 /// If the property name is one that is implicitly managed here, return that.
 /// Otherwise delegate this request to the backing property.
 /// </summary>
 public override Task <string> GetUnevaluatedPropertyValueAsync(string propertyName)
 {
     if (_propertyValues.TryGetValue(propertyName, out string unevaluatedPropertyValue))
     {
         return(Task.FromResult(unevaluatedPropertyValue));
     }
     return(DelegatedProperties.GetUnevaluatedPropertyValueAsync(propertyName));
 }
 /// <summary>
 /// If the property name is one that is implicitly managed here, remove it from
 /// the value map. Otherwise delegate this request to the backing property.
 /// </summary>
 public override Task DeletePropertyAsync(string propertyName, IReadOnlyDictionary <string, string> dimensionalConditions = null)
 {
     if (_propertyValues.TryRemove(propertyName, out string unevaluatedPropertyValue))
     {
         return(Task.CompletedTask);
     }
     return(DelegatedProperties.DeletePropertyAsync(propertyName, dimensionalConditions));
 }
예제 #3
0
            /// <summary>
            /// If a property exists in the delegated properties object, then pass the set
            /// through (overwrite). Otherwise manage the value in memory in this properties
            /// object.
            /// </summary>
            public override async Task SetPropertyValueAsync(string propertyName, string unevaluatedPropertyValue, IReadOnlyDictionary <string, string> dimensionalConditions = null)
            {
                var propertyNames = await DelegatedProperties.GetPropertyNamesAsync().ConfigureAwait(false);

                if (propertyNames.Contains(propertyName))
                {
                    // overwrite the property if it exists
                    await DelegatedProperties.SetPropertyValueAsync(propertyName, unevaluatedPropertyValue, dimensionalConditions).ConfigureAwait(false);
                }
                else
                {
                    // store the property in this property object, not in the project file
                    _propertyValues[propertyName] = unevaluatedPropertyValue;
                }
            }