Interface IBusinessRuleContext
Represents the definition of the IBusinessRuleContext that encapsulates all specific information about an individual event rule.
public interface IBusinessRuleContext
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.
TValue AddOrUpdate<TValue>(string key, Func<string, TValue> addValueFactory, Func<string, TValue, TValue> updateValueFactory) where TValue : notnull
Parameters
key
stringThe key to be added or whose value should be updated.
addValueFactory
Func<string, TValue>The function used to generate a value for an absent key.
updateValueFactory
Func<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
TValue
The type of an argument to pass into
addValueFactory
andupdateValueFactory
.
TryAdd<TValue>(string, TValue)
Attempts to add the specified key and value to the dictionary.
bool TryAdd<TValue>(string key, TValue value) where TValue : notnull
Parameters
key
stringThe key of the element to add.
value
TValueThe value of the element to add.
Returns
- bool
true
if the key/value pair was added to the dictionary successfully; otherwise,false
.
Type Parameters
TValue
Type of the value to add.
TryGet<TValue>(string, out TValue?)
Attempts to get the value associated with the specified key.
bool TryGet<TValue>(string key, out TValue? value)
Parameters
key
stringThe key of the value to get.
value
TValueWhen this method returns, contains the object that has the specified key, or the default value of the type if the operation failed.
Returns
- bool
true
if the key was found; otherwise,false
.
Type Parameters
TValue
Type 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
.
bool TryUpdate<TValue>(string key, TValue newValue, TValue comparisonValue) where TValue : notnull
Parameters
key
stringThe key of the value that is compared with
comparisonValue
and possibly replaced.newValue
TValueThe value that replaces the value of the element that has the specified
key
if the comparison results in equality.comparisonValue
TValueThe value that is compared with the value of the element that has the specified
key
.
Returns
- bool
true
if the value with key was equal to comparisonValue and was replaced with newValue; otherwise,false
.
Type Parameters
TValue
Type of the value to update.