Skip to content

Conversation

@adrianhall
Copy link
Collaborator

Closes #258

@adrianhall adrianhall added this to the 9.0.3 milestone May 23, 2025
@adrianhall adrianhall requested a review from Copilot May 23, 2025 18:11
@adrianhall adrianhall self-assigned this May 23, 2025
Copy link
Contributor

Copilot AI left a 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 pull request adds support for preserving local data by honoring the [JsonIgnore] attribute during push and pull operations. Key changes include:

  • Updating the project files to include a new dependency (xRetry) and reorganizing PackageReference entries.
  • Adding an integration test to verify that local data is preserved during pull and push operations.
  • Modifying operations in both the queue manager and pull operation manager to skip properties marked with [JsonIgnore].

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/CommunityToolkit.Datasync.Server.EntityFrameworkCore.Test.csproj Reorders and reassigns package and project references.
tests/CommunityToolkit.Datasync.Client.Test/Offline/Integration_Pull_Tests.cs Introduces a new test to validate local data preservation with [JsonIgnore].
tests/CommunityToolkit.Datasync.Client.Test/Helpers/IntegrationDbContext.cs Adds DbSet and configuration for the new ClientMovieWithLocalData entity.
tests/CommunityToolkit.Datasync.Client.Test/Helpers/ClientMovieWithLocalData.cs Implements a client model that leverages [JsonIgnore] to avoid syncing local-only data.
src/CommunityToolkit.Datasync.Client/Offline/OperationsQueue/OperationsQueueManager.cs Updates the replacement logic to skip properties marked with [JsonIgnore].
src/CommunityToolkit.Datasync.Client/Offline/Operations/PullOperationManager.cs Updates pull operations to exclude [JsonIgnore]-marked properties from being overwritten.
Directory.Packages.props Adds the xRetry package reference.
Comments suppressed due to low confidence (1)

src/CommunityToolkit.Datasync.Client/Offline/Operations/PullOperationManager.cs:75

  • [nitpick] Consider reusing or caching the reflection result for the set of [JsonIgnore] properties to avoid performance overhead when handling multiple pull requests for the same entity type.
HashSet<string> ignoredProps = pullResponse.EntityType.GetProperties(BindingFlags.Public | BindingFlags.Instance)

@adrianhall adrianhall closed this May 23, 2025
@adrianhall adrianhall reopened this May 23, 2025
@adrianhall adrianhall merged commit eb51454 into CommunityToolkit:main May 23, 2025
10 of 11 checks passed
@adrianhall adrianhall deleted the issues/258 branch May 23, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to save extra properties in offline db which are not exists in remote table

1 participant