GenericRule
using Stashbox.Resolution;
using System;
namespace Stashbox.Registration.SelectionRules
{
internal class GenericRule : IRegistrationSelectionRule
{
public bool IsValidForCurrentRequest(TypeInformation typeInformation, ServiceRegistration registration, ResolutionContext resolutionContext)
{
if (typeInformation.Type.IsClosedGenericType())
return typeInformation.Type.SatisfiesGenericConstraintsOf(registration.ImplementationTypeInfo);
return true;
}
public bool ShouldIncrementWeight(TypeInformation typeInformation, ServiceRegistration registration, ResolutionContext resolutionContext)
{
return false;
}
}
}