Summary of the new feature / enhancement
#26514 introduced the -ExcludeProperty parameter to Format-Table/List/Wide/Custom. The implementation requires calling ApplyExcludePropertyFilter() at different locations depending on the ViewGenerator class:
| ViewGenerator |
Call Location |
| Table |
End of Initialize() |
| List |
End of SetUpActiveProperties() (called from Initialize()) |
| Wide |
End of SetUpActiveProperty() (called lazily from GeneratePayload()) |
| Complex |
Filters locally within DisplayObject() (doesn't use base class method) |
This works correctly, but has maintainability concerns:
- Future implementations: New
ViewGenerator subclasses must remember to call the filter method at the right place
- Discoverability: It's not obvious from the base class that this step is required
- Scattered call sites: The filter is applied in different methods depending on the subclass
A centralized approach would make the code more maintainable and less error-prone.
Proposed technical implementation details (optional)
The main challenge is that activeAssociationList is built at different times:
- Table/List: During
Initialize()
- Wide: Lazily during
GeneratePayload()
- Complex: Uses a local variable instead of the base class member
This timing difference makes simple centralization non-trivial. Further investigation is needed to determine the best approach.
Related: #26514
Summary of the new feature / enhancement
#26514 introduced the
-ExcludePropertyparameter toFormat-Table/List/Wide/Custom. The implementation requires callingApplyExcludePropertyFilter()at different locations depending on the ViewGenerator class:Initialize()SetUpActiveProperties()(called fromInitialize())SetUpActiveProperty()(called lazily fromGeneratePayload())DisplayObject()(doesn't use base class method)This works correctly, but has maintainability concerns:
ViewGeneratorsubclasses must remember to call the filter method at the right placeA centralized approach would make the code more maintainable and less error-prone.
Proposed technical implementation details (optional)
The main challenge is that
activeAssociationListis built at different times:Initialize()GeneratePayload()This timing difference makes simple centralization non-trivial. Further investigation is needed to determine the best approach.
Related: #26514