Add ability to exclude by type name, attribute or assignable type#25
Add ability to exclude by type name, attribute or assignable type#25Dreamescaper merged 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to exclude types from service registrations based on either their type name (using wildcards) or by the presence of a specific attribute. Key changes include updating the AttributeModel to support new exclusion parameters, extending the attribute generator to include new properties with updated documentation, and adjusting the dependency injection filtering along with adding corresponding tests.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ServiceScan.SourceGenerator/Model/AttributeModel.cs | Added new parameters to capture exclusion options and updated the Create method accordingly. |
| ServiceScan.SourceGenerator/GenerateAttributeSource.cs | Introduced new attribute properties and adjusted documentation. |
| ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs | Incorporated new logic to filter out types based on exclusion rules. |
| ServiceScan.SourceGenerator.Tests/AddServicesTests.cs | Added tests for excluding services by type name and attribute. |
| README.md | Updated usage documentation to reflect the new exclusion properties. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds new exclusion options to the service registration source generator, allowing users to prevent types from being registered based on type names, attributes, or assignability. Key changes include:
- Updates to the AttributeModel to include new exclusion properties.
- Adjustments to the generator logic in DependencyInjectionGenerator.FilterTypes.cs to handle exclusions.
- New tests and documentation updates to validate and explain the new behavior.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ServiceScan.SourceGenerator/Model/AttributeModel.cs | Added exclusion properties and updated the Create method to set exclusion type names. |
| ServiceScan.SourceGenerator/GenerateAttributeSource.cs | Introduced new properties for exclusions and updated comments accordingly. |
| ServiceScan.SourceGenerator/EquatableArray.cs | Changed the EquatableArrayBuilder class accessibility for better encapsulation. |
| ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs | Updated filtering logic to consider exclusions based on type name, attribute, and assignability. |
| ServiceScan.SourceGenerator.Tests/AddServicesTests.cs | Added tests to verify the new exclusion functionalities. |
| README.md | Updated documentation to reflect new exclusion parameters and behavior. |
ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
This PR adds new exclusion criteria for type registration by introducing filtering based on type name, attribute presence, and assignable types. Key changes include additions to the AttributeModel for new exclusion properties, updates to the generator’s filtering logic and attribute source definitions, and comprehensive new tests and README updates validating these changes.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ServiceScan.SourceGenerator/Model/AttributeModel.cs | Adds new exclusion properties and updates the Create method accordingly. |
| ServiceScan.SourceGenerator/GenerateAttributeSource.cs | Updates property names and comments to reflect the new exclusion options. |
| ServiceScan.SourceGenerator/EquatableArray.cs | Changes class modifier for improved internal accessibility. |
| ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs | Implements and applies new exclusion filters in the DI generator logic. |
| ServiceScan.SourceGenerator.Tests/AddServicesTests.cs | Introduces new test cases to verify the exclusion filter functionality. |
| README.md | Updates documentation to include details about the new exclusion filters. |
Comments suppressed due to low confidence (1)
ServiceScan.SourceGenerator/Model/AttributeModel.cs:15
- Consider aligning the naming of 'ExcludeByAttributeTypeName' with the property 'ExcludeByAttribute' in GenerateAttributeSource.cs for consistency.
string? ExcludeByAttributeTypeName,
No description provided.