-
-
Notifications
You must be signed in to change notification settings - Fork 375
doc(AttributeTable): auto generate AttributeTable content #7529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your PR, @copilot. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Co-authored-by: ArgoZhang <[email protected]>
Co-authored-by: ArgoZhang <[email protected]>
Co-authored-by: ArgoZhang <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7529 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 748 748
Lines 33012 33012
Branches 4588 4588
=========================================
Hits 33012 33012
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# Conflicts: # src/BootstrapBlazor/Components/Circle/Circle.razor.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the attribute documentation system from manual maintenance to automatic reflection-based generation. It introduces a caching service that extracts component parameter information dynamically from XML documentation.
Changes:
- Added reflection-based automatic extraction of component attributes via
ComponentAttributeCacheService - Extended
AttributeItemwith aVersionproperty for version tracking - Enhanced
AttributeTableto accept aTypeparameter for automatic attribute generation - Configured XML documentation file copying during publish
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ComponentAttributeCacheService.cs | New static caching service for extracting component attributes via reflection with XML doc parsing |
| AttributeItem.cs | Added Version property to support XML version tags |
| AttributeTable.razor.cs | Added Type parameter to enable automatic attribute generation |
| AttributeTable.razor | Added Version column to display version information |
| Circles.razor.cs | Replaced manual 52-line attribute array with single reflection call |
| Circles.razor | Changed from manual GetAttributes() call to Type parameter |
| Directory.Build.targets | Added XML documentation copying task for publish |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Issues
close #7533
Summary By Copilot
Replaced manual AttributeItem array maintenance with reflection-based automatic extraction from Circle component parameters. Implemented global static cache for performance.
Changes
AttributeItem class (
src/BootstrapBlazor.Server/Data/AttributeItem.cs)Versionproperty for XML documentation version tagsComponentAttributeCacheService (
src/BootstrapBlazor.Server/Services/ComponentAttributeCacheService.cs)ConcurrentDictionarycache for component attribute metadata[Parameter]attributes<para><version>), default valuesXmlReaderSettings, assembly location validation, specific exception handlingCircles.razor.cs (
src/BootstrapBlazor.Server/Components/Samples/Circles.razor.cs)BootstrapBlazor.csproj (
src/BootstrapBlazor/BootstrapBlazor.csproj)GenerateDocumentationFilefor XML commentsRegression?
Risk
Isolated change to demo component attribute display. No API changes, backward compatible. Cache invalidation available via
ClearCache().Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Original prompt
目标
重构 Circles 示例组件,从手动维护 AttributeItem 列表改为使用反射自动获取 Circle 组件的参数信息,并通过全局静态字典缓存提升性能。
需要实现的功能
1. 扩展 AttributeItem 类添加 Version 属性
文件:
src/BootstrapBlazor.Server/Data/AttributeItem.cs在 AttributeItem 类中添加一个新的 Version 属性:
2. 创建全局静态缓存服务
创建新文件:
src/BootstrapBlazor.Server/Services/ComponentAttributeCacheService.cs实现一个全局静态字典缓存服务,用于缓存组件的 AttributeItem 列表: