IAspectReceiver<TDeclaration>.AddAspectIfEligible Method
AddAspectIfEligible(Type, Func<TDeclaration, IAspect>, EligibleScenarios)
Adds an aspect to the current set of declarations but only if the aspect is eligible for the declaration. This overload is non-generic.
Declaration
void AddAspectIfEligible(Type aspectType, Func<out TDeclaration, IAspect> createAspect, EligibleScenarios eligibility = EligibleScenarios.Inheritance | EligibleScenarios.Aspect)
Parameters
Type | Name | Description |
---|---|---|
Type | aspectType | The exact type of the aspect returned by |
Func<TDeclaration, IAspect> | createAspect | A function that returns the aspect for a given declaration. |
EligibleScenarios | eligibility | The scenarios for which the aspect may be eligible. The default value is Default | Inheritance. If None is provided, eligibility is not checked. |
AddAspectIfEligible<TAspect>(Func<TDeclaration, TAspect>, EligibleScenarios)
Adds an aspect to the current set of declarations but only if the aspect is eligible for the declaration.
Declaration
void AddAspectIfEligible<TAspect>(Func<out TDeclaration, TAspect> createAspect, EligibleScenarios eligibility = EligibleScenarios.Inheritance | EligibleScenarios.Aspect) where TAspect : class, IAspect<out TDeclaration>
Parameters
Type | Name | Description |
---|---|---|
Func<TDeclaration, TAspect> | createAspect | A function that returns the aspect for a given declaration. |
EligibleScenarios | eligibility | The scenarios for which the aspect may be eligible. The default value is Default | Inheritance. If None is provided, eligibility is not checked. |
Type Parameters
Name | Description |
---|---|
TAspect |
AddAspectIfEligible<TAspect>(EligibleScenarios)
Adds an aspect to the current set of declarations using the default constructor of the aspect type. This method
does not verify the eligibility of the declaration for the aspect unless you specify the eligibility
parameter.
This overload creates a new instance of the aspect class for each eligible target declaration.
Declaration
void AddAspectIfEligible<TAspect>(EligibleScenarios eligibility = EligibleScenarios.Inheritance | EligibleScenarios.Aspect) where TAspect : class, IAspect<out TDeclaration>, new()
Parameters
Type | Name | Description |
---|---|---|
EligibleScenarios | eligibility | The scenarios for which the aspect may be eligible. The default value is Default | Inheritance. If None is provided, eligibility is not checked. |
Type Parameters
Name | Description |
---|---|
TAspect |