ConditionRule
using Stashbox.Resolution;
namespace Stashbox.Registration.SelectionRules
{
internal class ConditionRule : IRegistrationSelectionRule
{
public bool IsValidForCurrentRequest(TypeInformation typeInformation, ServiceRegistration registration, ResolutionContext resolutionContext)
{
return true;
}
public bool ShouldIncrementWeight(TypeInformation typeInformation, ServiceRegistration registration, ResolutionContext resolutionContext)
{
if (registration.HasCondition)
return registration.IsUsableForCurrentContext(typeInformation);
return false;
}
}
}