-
-
Notifications
You must be signed in to change notification settings - Fork 362
fix(TableDynamicContext): AddAutoGenerateColumnAttribute parameter Text not work #6966
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
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR corrects the localization source for auto-generated column text in the dynamic table sample, refactors attribute builder creation and caching into a helper method, disables an unused demo block, and streamlines array handling and column instantiation across dynamic context utilities. Class diagram for DynamicObjectContext attribute builder changesclassDiagram
class DynamicObjectContext {
+AddAttribute(columnName, attributeType, types, constructorArgs, propertyInfos, propertyValues)
-CustomerAttributeBuilderCache
}
class CustomAttributeBuilder
DynamicObjectContext --> CustomAttributeBuilder : creates
DynamicObjectContext : +CreateCustomAttributeBuilder()
Class diagram for DataTableDynamicContext column instantiation updateclassDiagram
class DataTableDynamicContext {
-InternalGetColumns()
}
class InternalTableColumn {
+InternalTableColumn(columnName, dataType)
}
DataTableDynamicContext --> InternalTableColumn : instantiates
Class diagram for DynamicObjectContextExtensions array handling updateclassDiagram
class DynamicObjectContextExtensions {
+AddMultipleParameterAttribute<TAttribute>(context, columnName, parameters)
}
class DynamicObjectContext {
+AddAttribute(columnName, attributeType, types, constructorArgs, propertyInfos, propertyValues)
}
DynamicObjectContextExtensions --> DynamicObjectContext : calls AddAttribute
Class diagram for EmitHelper property attribute application updateclassDiagram
class EmitHelper {
-CreateProperty(typeBuilder, propertyName, propertyType, attributeBuilds)
}
class CustomAttributeBuilder
EmitHelper --> CustomAttributeBuilder : applies attributes
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 PR fixes an issue where the Text parameter in AddAutoGenerateColumnAttribute was not working correctly. The root cause was that CustomAttributeBuilder instances were being reused across multiple properties, causing parameter values to be shared incorrectly. The fix ensures each attribute gets its own CustomAttributeBuilder instance.
Key changes:
- Refactored
CustomAttributeBuildercreation to use a local function that creates new instances - Updated collection initializers to use modern C# collection expressions
- Modified
InternalTableColumnconstructor call to remove unusedCaptionparameter
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/BootstrapBlazor/Dynamic/DynamicObjectContext.cs | Fixed bug by creating separate CustomAttributeBuilder instances via local function |
| src/BootstrapBlazor/Dynamic/DataTableDynamicContext.cs | Removed unused Caption parameter from InternalTableColumn constructor |
| src/BootstrapBlazor/Utils/EmitHelper.cs | Updated to use collection expression syntax |
| src/BootstrapBlazor/Extensions/DynamicObjectContextExtensions.cs | Updated to use collection expression syntax |
| src/BootstrapBlazor.Server/Components/Samples/Table/TablesDynamic.razor.cs | Changed localizer from Localizer to LocalizerFoo |
| src/BootstrapBlazor.Server/Components/Samples/Table/TablesDynamic.razor | Commented out demo block |
| src/BootstrapBlazor/BootstrapBlazor.csproj | Version bump to 9.11.4 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Hey there - I've reviewed your changes - here's some feedback:
- This PR mixes the Localizer fix with unrelated refactors in DynamicObjectContext and EmitHelper—please split these changes into focused PRs for clarity.
- The new bracket-only syntax (
[]and slice-like notation) in AddMultipleParameterAttribute and EmitHelper isn’t valid C# and will not compile—please revert to proper array initializers. - Removing the
col.Captionparameter in DataTableDynamicContext.InternalGetColumns could affect existing caption behavior—please confirm this is intentional and adjust consumers if needed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- This PR mixes the Localizer fix with unrelated refactors in DynamicObjectContext and EmitHelper—please split these changes into focused PRs for clarity.
- The new bracket-only syntax (`[]` and slice-like notation) in AddMultipleParameterAttribute and EmitHelper isn’t valid C# and will not compile—please revert to proper array initializers.
- Removing the `col.Caption` parameter in DataTableDynamicContext.InternalGetColumns could affect existing caption behavior—please confirm this is intentional and adjust consumers if needed.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6966 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 740 740
Lines 31900 31900
Branches 4473 4473
=========================================
Hits 31900 31900
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:
|
Link issues
fixes #6965
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Fix dynamic table column text localization issue and refactor attribute builder and dynamic context methods
Bug Fixes:
Enhancements:
Chores: