-
-
Notifications
You must be signed in to change notification settings - Fork 362
doc(ITcpSocketClient): update AddDataPackageAdapter documentation #6686
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 GuideThis PR refines the ITcpSocketClient documentation by renaming the converter attribute, introducing a new ConfigureDataConverters/ DataPackageAdapter sample for MockEntity, and updating all sample usages of SetDataPackageAdapter to AddDataPackageAdapter (with memory‐leak notes). Sequence diagram for AddDataPackageAdapter usage and callback invocationsequenceDiagram
actor User
participant ITcpSocketClient
participant DataPackageAdapter
participant MockEntity
User->ITcpSocketClient: AddDataPackageAdapter(adapter, OnReceiveAsync)
ITcpSocketClient->DataPackageAdapter: Assign adapter
ITcpSocketClient->User: OnReceiveAsync(MockEntity)
User->ITcpSocketClient: (Optionally) Remove callback to prevent memory leak
Class diagram for updated MockEntity and Data converter configurationclassDiagram
class MockEntity {
+byte[]? Header
+byte[]? Body
}
class DataTypeConverter {
+Type: Type
}
class DataPropertyConverterAttribute {
+Type: Type
+Offset: int
+Length: int
}
MockEntity <|-- DataTypeConverter
MockEntity "1" o-- "*" DataPropertyConverterAttribute: property converters
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 updates documentation for the ITcpSocketClient interface, specifically changing method references from SetDataPackageAdapter to AddDataPackageAdapter and adds new configuration examples. The changes include localized content updates, code sample corrections, and package version updates.
- Updated method references from
SetDataPackageAdaptertoAddDataPackageAdapteracross documentation - Added new configuration examples for data type converters using
ConfigureDataConverters - Updated package references to newer versions
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/BootstrapBlazor.Server/Locales/zh-CN.json | Added Chinese localization for new configuration section |
| src/BootstrapBlazor.Server/Locales/en-US.json | Added English localization for new configuration section |
| src/BootstrapBlazor.Server/Components/Samples/Sockets/DataEntities.razor | Corrected attribute name and added configuration example |
| src/BootstrapBlazor.Server/Components/Samples/Sockets/Adapters.razor.cs | Updated method reference in comments |
| src/BootstrapBlazor.Server/Components/Samples/Sockets/Adapters.razor | Updated method reference and added memory leak warning |
| src/BootstrapBlazor.Server/Components/Samples/SocketFactories.razor | Updated method reference and added memory leak prevention comment |
| src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | Updated package versions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <Pre>// 实战中可以使用 ITcpSocketClient 扩展方法 SetDataPackageAdapter 简化代码 | ||
| _client.SetDataPackageAdapter(_dataAdapter, UpdateReceiveLog);</Pre> | ||
| <Pre>// 实战中可以使用 ITcpSocketClient 扩展方法 AddDataPackageAdapter 简化代码 | ||
| // 如果 _client 实例在当前页面不销毁时,切记使用 AddDataPackageAdapter 移除当前页面加载的 UpdateReceiveLog 回调方法避免内存泄露 |
Copilot
AI
Aug 27, 2025
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.
The comment mentions using 'AddDataPackageAdapter' to remove a callback method, but 'AddDataPackageAdapter' is typically used to add adapters. The comment should reference the correct method name for removing adapters, likely 'RemoveDataPackageAdapter'.
| // 如果 _client 实例在当前页面不销毁时,切记使用 AddDataPackageAdapter 移除当前页面加载的 UpdateReceiveLog 回调方法避免内存泄露 | |
| // 如果 _client 实例在当前页面不销毁时,切记使用 RemoveDataPackageAdapter 移除当前页面加载的 UpdateReceiveLog 回调方法避免内存泄露 |
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6686 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 739 739
Lines 31698 31698
Branches 4462 4462
=========================================
Hits 31698 31698
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 #6685
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Update ITcpSocketClient AddDataPackageAdapter documentation by replacing obsolete methods with the new generic overload, adding guidance to avoid memory leaks, and introducing a demo for configuring custom data converters.
Documentation: