/// <summary> /// Add a condition to the collection. /// </summary> /// <param name="conditionName">The unique name of the condition.</param> /// <param name="condition">The condition instance that will be added to the collection.</param> /// <exception cref="System.ArgumentException">Thrown if a condition with the given name already exists in the collection.</exception> public void AddCondition(string conditionName, IRatingCondition condition) { _ratingConditions.Add(conditionName, condition); if (condition is ICachableCondition cachableCondition && cachableCondition.CacheCurrentValue) { if (!RatingConditionCache.Load(conditionName, cachableCondition)) { RatingConditionCache.Save(conditionName, cachableCondition); } } }