Class BusinessRuleContext
Represents the implementation of the IBusinessRuleContext that encapsulates all specific information about an individual event rule.
public class BusinessRuleContext : IBusinessRuleContext
- Inheritance
-
BusinessRuleContext
- Implements
- Inherited Members
Methods
AddOrUpdate<TValue>(string, Func<string, TValue>, Func<string, TValue, TValue>)
Adds a key/value pair if the key does not already exist, or updates a key/value pair if the key already exists.
public TValue AddOrUpdate<TValue>(string key, Func<string, TValue> addValueFactory, Func<string, TValue, TValue> updateValueFactory) where TValue : notnull
Parameters
keystringThe key to be added or whose value should be updated.
addValueFactoryFunc<string, TValue>The function used to generate a value for an absent key.
updateValueFactoryFunc<string, TValue, TValue>The function used to generate a new value for an existing key based on the key's existing value.
Returns
- TValue
The new value for the key. This will be either be the result of
addValueFactory(if the key was absent) or the result ofupdateValueFactory(if the key was present).
Type Parameters
TValueThe type of an argument to pass into
addValueFactoryandupdateValueFactory.
TryAdd<TValue>(string, TValue)
Attempts to add the specified key and value to the dictionary.
public bool TryAdd<TValue>(string key, TValue value) where TValue : notnull
Parameters
keystringThe key of the element to add.
valueTValueThe value of the element to add.
Returns
- bool
trueif the key/value pair was added to the dictionary successfully; otherwise,false.
Type Parameters
TValueType of the value to add.
TryGet<TValue>(string, out TValue?)
Attempts to get the value associated with the specified key.
public bool TryGet<TValue>(string key, out TValue? value)
Parameters
keystringThe key of the value to get.
valueTValueWhen this method returns, contains the object that has the specified key, or the default value of the type if the operation failed.
Returns
- bool
trueif the key was found; otherwise,false.
Type Parameters
TValueType of the value to get.
TryUpdate<TValue>(string, TValue, TValue)
Updates the value associated with key to newValue if the existing value with key is equal to comparisonValue.
public bool TryUpdate<TValue>(string key, TValue newValue, TValue comparisonValue) where TValue : notnull
Parameters
keystringThe key of the value that is compared with
comparisonValueand possibly replaced.newValueTValueThe value that replaces the value of the element that has the specified
keyif the comparison results in equality.comparisonValueTValueThe value that is compared with the value of the element that has the specified
key.
Returns
- bool
trueif the value with key was equal to comparisonValue and was replaced with newValue; otherwise,false.
Type Parameters
TValueType of the value to update.