Repository navigation
Conversation
feat: Add async XML methods and improve stream handling Added async methods `ConvertAsync` and `SerializerAsync<T>` in `XmlUtility.cs` for XML processing, with support for cancellation and stream handling via the `closeInput` parameter. Updated `Deserialize<T>` and `Convert` methods for better parameter formatting and added `closeInput` control. In `XmlUtilityTests.cs`, added `ConvertAsyncTest` to validate async XML conversion. Adjusted code formatting for consistency.
Refactored `DataOperationTests.cs`: - Added `using System.Threading;` and `using System.Collections.Generic;`. - Enabled APM in the constructor with `Senparc.CO2NET.APM.Config.EnableAPM = true;`. - Fixed `BuildTestData` by appending `.Wait()` to ensure task completion. - Commented out "Visitor Volume" related assertions in `SetAndGetTest` and `ReadAndCleanDataItemsTest`. - Commented out "Visitor Volumn" (typo) related assertions in another test. Updated `DataOperation.cs`: - Added async cache retrieval logic in `GetDataItemListAsync` using `cacheStragety.GetAsync<List<DataItem>>`. These changes focus on test adjustments and improving async data handling.
Refactored test methods to support async operations, improving code readability and efficiency. Introduced a flexible caching strategy with dependency injection in `DataOperation.cs`. Updated Redis configuration to use `10.37.129.2:6379` and centralized its management. Added `CanUseRedis` method in `RedisManager.cs` for Redis availability checks. Enhanced code reusability by introducing `SetRedis` method for Redis setup in multiple test files. Replaced hardcoded Redis connection strings with a configurable `DefaultDomain` property. Removed redundant code and improved code formatting across multiple files. Updated project files to support the latest C# features and ensured consistency in test cases.
Replaced `await` with `_=` in `BuildTestDataAsync` to trigger `SetAsync` without waiting, improving performance. Added `Thread.Sleep(1000)` at the method's end to ensure async operations complete and data is cached. Removed cache-related debugging code from `SetAndGetTest`, retaining core data operation assertions.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances XML serialization capabilities by adding asynchronous methods and improving cache module configuration for Redis connections across tests.
- Adds async serialization methods to XmlUtility with proper cancellation token support
- Consolidates Redis configuration setup through reusable helper methods in test files
- Updates version numbers across multiple project files
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Senparc.CO2NET/Utilities/XmlUtility/XmlUtility.cs | Adds async XML serialization methods and improves stream handling with closeInput parameter |
| src/Senparc.CO2NET.Tests/Utilities/XmlUtility/XmlUtilityTets.cs | Adds async test for XML conversion functionality |
| src/Senparc.CO2NET.Cache.CsRedis/RedisManager.cs | Adds CanUseRedis method for Redis connection validation |
| src/Senparc.CO2NET.APM/DataOperation.cs | Refactors to accept custom cache strategy in constructor |
| Multiple test files | Consolidates Redis configuration setup through helper methods |
| Multiple project files | Updates version numbers for new release |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.