Skip to content
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

Unable to Update Scope Info in SQL Server Sync with RemoteOrchestrator #1207

Open
nicolazreinh opened this issue Jul 3, 2024 · 1 comment

Comments

@nicolazreinh
Copy link

Description:
I am experiencing an issue with updating the scope info using the Dotmim.Sync library. I am using ASP.NET Core Web Proxy with change tracking in SQL Server.

Steps to Reproduce:

  1. Call:
    await remoteOrchestrator.DeprovisionAsync(scopeName, SyncProvision.ScopeInfo);
  2. Verify that the scope info is not removed.
  3. Attempt to update the scope info using:
    await remoteOrchestrator.ProvisionAsync(scopeName, setup, overwrite: true);
  4. Verify that the old scope info remains unchanged.

Expected Behavior:
Calling DeprovisionAsync should remove the scope info, and ProvisionAsync with overwrite set to true should refresh and update the scope info as documented.

Actual Behavior:

  • The call to DeprovisionAsync does not remove the scope info.
  • The call to ProvisionAsync with overwrite set to true retains the old scope info instead of refreshing it.

Additional Context:

  • Dotmim.Sync Version: 1.0.2

Any assistance in resolving this issue would be greatly appreciated. Thank you!

@Mimetis
Copy link
Owner

Mimetis commented Jul 3, 2024

DeprovisionAsync(SyncProvision.ScopeInfo) removes the table itself.
It's literally a DROP TABLE query that is excuted behind the scene

Just tried with AdventureWorks; and it's seems it's working fine for me:

 var remoteOrchestrator = new RemoteOrchestrator(serverProvider, options);
 await remoteOrchestrator.DeprovisionAsync(SyncProvision.ScopeInfo);

image

And ProvisionAsync is all about creating the tracking table, the stored procedures, the scope info table and the scope info record if needed

IF you ONLY want to remove a ScopeInfo, you can do it, using the DeleteScopeInfoAsync method:

var remoteOrchestrator = new RemoteOrchestrator(serverProvider, options);

var scopeInfo = await remoteOrchestrator.GetScopeInfoAsync(scopeName);
await remoteOrchestrator.DeleteScopeInfoAsync(scopeInfo);

IF you want to recreate a scope, you don't have to explicitly create it, just call a ProvisionAsync that will:

  • Create the scope
  • Create all the metadatas required (stored procedures; triggers, scope info row etc...)
// Create a new setup for a new scope:
var newSetup = new SyncSetup("Customer", "CustomerAddress");

// Provision will create everything needed for this scope and will return the new scope
var newScopeInfo = await remoteOrchestrator.ProvisionAsync("CustomerScope", newSetup);

And finally, if you just want to overwrite an existing scope (without deleting it before) you can use the overwrite thing:

// Create a new setup for a new scope:
var newSetup = new SyncSetup("Address", "Customer", "CustomerAddress");

// Provision will create everything needed for this scope and will return the new scope
var newScopeInfo = await remoteOrchestrator.ProvisionAsync("CustomerScope", newSetup, overwrite:true);

Make sense ?

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

No branches or pull requests

2 participants