-
-
Notifications
You must be signed in to change notification settings - Fork 363
feat(ObjectExtensions): add CreateInstanceWithCascade extension method #5491
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 by SourceryThis pull request introduces the Sequence diagram for CreateInstanceWithCascadesequenceDiagram
participant OE as ObjectExtensions
participant A as Activator
participant I as Instance
OE->>A: CreateInstance<TItem>()
A-->>I: Instance of TItem
OE->>I: EnsureInitialized()
loop For each class-type property
I->>OE: CreateInstance(PropertyType)
OE->>A: CreateInstance(PropertyType)
A-->>I: Instance of PropertyType
I->>I: EnsureInitialized()
end
I-->>OE: Initialized Instance
OE-->>OE: Return instance
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.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a non-recursive version of
CreateInstanceto avoid potential stack overflows. - The reflection code in
EnsureInitializedcould be a performance bottleneck; consider caching the property information.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5491 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 649 649
Lines 29541 29563 +22
Branches 4163 4165 +2
=========================================
+ Hits 29541 29563 +22 ☔ View full report in Codecov by Sentry. |
|
@sourcery-ai review |
Link issues
fixes #5490
Summary By Copilot
This pull request includes several changes to the
BootstrapBlazorproject, focusing on version updates, exception handling improvements, and enhancements to theObjectExtensionsclass. The most important changes are listed below:Version Update:
src/BootstrapBlazor/BootstrapBlazor.csprojfrom9.4.3-beta03to9.4.3-beta04.Exception Handling:
CreateInstancemethod insrc/BootstrapBlazor/Components/Table/Table.razor.Edit.csby including the caught exception in theInvalidOperationException.ObjectExtensions Enhancements:
CreateInstanceWithCascade<TItem>to create an instance of a type and ensure all class-type properties are initialized insrc/BootstrapBlazor/Extensions/ObjectExtensions.cs.TryConvertTomethod by removing theMaybeNullWhen(false)attribute and updating the method to use pattern matching for better readability insrc/BootstrapBlazor/Extensions/ObjectExtensions.cs.src/BootstrapBlazor/Extensions/ObjectExtensions.cs. [1] [2]Regression?
[If yes, specify the version the behavior has regressed from]
[是否影响老版本]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
New Features: