Skip to content

Conversation

@Lekco1320
Copy link
Collaborator

@Lekco1320 Lekco1320 commented Dec 23, 2024

Add explain of binding complex object

Description

Closes #4907

preview_cn
preview_en

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

[是否影响老版本]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add an example to demonstrate how to bind complex objects to the table component.

New Features:

  • Added support for binding complex objects to the Table component.

Tests:

  • Added a demo showcasing the binding of complex objects.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 23, 2024

Reviewer's Guide by Sourcery

This pull request adds an example of how to bind a complex object to a Table component.

Sequence diagram for updating Company property in ComplexItems

sequenceDiagram
    participant User
    participant Button
    participant TablesColumn
    participant ComplexItems
    User->>Button: Click 'Set Company' button
    Button->>TablesColumn: OnClickCompanyButton()
    loop For each ComplexFoo in ComplexItems
        TablesColumn->>ComplexItems: Set new Company with random name
    end
    TablesColumn-->>Button: Task.CompletedTask
    Button-->>User: Update complete
Loading

Class diagram showing the new ComplexFoo and Company classes

classDiagram
    class Foo {
        +int Id
        +string Name
        +DateTime DateTime
        +string Address
        +int Count
        +bool Complete
        +EnumEducation Education
        +int ReadonlyColumn
    }
    class ComplexFoo {
        +int Age
        +Company? Company
        +ComplexFoo(int age)
        +static ComplexFoo Generate(IStringLocalizer~Foo~ localizer)
        +static List~ComplexFoo~ GenerateComplexFoo(IStringLocalizer~Foo~ localizer, int count)
    }
    class Company {
        +string Name
        +Company(string name)
    }
    Foo <|-- ComplexFoo
    ComplexFoo o-- Company
    note for ComplexFoo "New complex class that extends Foo"
    note for Company "Simple class to demonstrate complex object binding"
Loading

File-Level Changes

Change Details Files
Added an example for binding complex objects to the Table component.
  • Added a new demo block to the TablesColumn.razor file to showcase the binding of complex objects.
  • Added ComplexFoo class, CreateComplexFoo method, and OnQueryComplexFooAsync method to the TablesColumn.razor.cs file to handle complex object binding and querying.
  • Added new localization strings for the complex object binding example in both en-US.json and zh-CN.json files.
src/BootstrapBlazor.Server/Components/Samples/Table/TablesColumn.razor
src/BootstrapBlazor.Server/Components/Samples/Table/TablesColumn.razor.cs
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto
Copy link

bb-auto bot commented Dec 23, 2024

Thanks for your PR, @Lekco1320. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@bb-auto bb-auto bot requested a review from ArgoZhang December 23, 2024 03:14
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Lekco1320 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The diff shows modifications to localization files (en-US.json and zh-CN.json) but the actual changes are not visible. Please include these changes in the PR to ensure documentation is complete.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@bb-auto bb-auto bot added the documentation Improvements or additions to documentation label Dec 23, 2024
@bb-auto bb-auto bot added this to the v9.0.0 milestone Dec 23, 2024
@Lekco1320 Lekco1320 changed the title doc(Table): add explain of binding complex object #4907 doc(Table): add explain of binding complex object Dec 23, 2024
@Lekco1320
Copy link
Collaborator Author

@microsoft-github-policy-service agree

@ArgoZhang ArgoZhang merged commit 8de9a2e into dotnetcore:main Dec 23, 2024
3 checks passed
@codecov
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4350928) to head (022b940).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4922   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          628       628           
  Lines        28082     28082           
  Branches      4042      4042           
=========================================
  Hits         28082     28082           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc(Table): null exception when use complex model

2 participants