You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the feature you would like to see implemented:
I would like to request a feature to exclude classes that inherit from Attribute in the Source Generator. This feature would allow users to avoid unnecessary code generation for classes that are not intended for dependency injection.
Describe the solution you'd like:
Modify the Source Generator to include a check for classes that inherit from Attribute and exclude them from the generation process. This can be achieved by iterating through the classes and checking their inheritance chain to identify those that inherit from Attribute.
Example:
foreach(var classSymbol in compilation.GetSymbols()){if(!InheritsFromAttribute(classSymbol)){// Proceed with code generation}}boolInheritsFromAttribute(INamedTypeSymbolclassSymbol){while(classSymbol!=null){if(classSymbol.Name == nameof(Attribute)){returntrue;}classSymbol= classSymbol.BaseType;}returnfalse;}
Describe alternatives you've considered:
An alternative solution could involve using an attribute (e.g., [VContainerExclude]) on specific classes to manually exclude them from the code generation process. However, this approach requires additional manual work from users and may not be as efficient as automatically excluding classes inheriting from Attribute.
The text was updated successfully, but these errors were encountered:
Please describe the feature you would like to see implemented:
I would like to request a feature to exclude classes that inherit from Attribute in the Source Generator. This feature would allow users to avoid unnecessary code generation for classes that are not intended for dependency injection.
Describe the solution you'd like:
Modify the Source Generator to include a check for classes that inherit from Attribute and exclude them from the generation process. This can be achieved by iterating through the classes and checking their inheritance chain to identify those that inherit from Attribute.
Example:
Describe alternatives you've considered:
An alternative solution could involve using an attribute (e.g., [VContainerExclude]) on specific classes to manually exclude them from the code generation process. However, this approach requires additional manual work from users and may not be as efficient as automatically excluding classes inheriting from Attribute.
The text was updated successfully, but these errors were encountered: