Skip to content

(#258) Added [JsonIgnore] support for local data preservation. #363

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

Merged
merged 2 commits into from
May 23, 2025

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 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