Comments (3)
OnRowsChangesApplied
is called for every table and depends on multiple factors:
- If you have multiple batch files to be applied, for one table, it will be called for each batch
- If you have set a batch a max lines count, it will be called also for each max lines count applied
- And finally it will be called for each state of your table
Modified
andDeleted
If your scenario, I guess it's called for the state Modified
and Deleted
One thing you can do, is to check the values of the argument, something like that:
agent.LocalOrchestrator.OnRowsChangesApplied(args =>
{
// check state
if (args.State == SyncRowState.Modified)
Console.WriteLine("State: Insert or Edit rows");
else if (args.State == SyncRowState.Deleted)
Console.WriteLine("State: Delete rows");
else
Console.WriteLine($"State: Retry or Fail ?: {args.State}");
// Check if we have some rows applied
if (args.SyncRows == null || args.SyncRows.Count <= 0)
Console.WriteLine($"No rows applied for this state");
});
If you don't have bulk mode enabled (Only SqlSyncProvider
supports it), OnRowsChangesApplied
is called for every rows, twice (each state)
If you need less granular event, you can use
OnBatchChangesApplied
that will only be raised for each batch files applied.OnTableChangesApplied
that will occurs at the end, after all batches are applied and all conflicts resolved.
That being said, you still have two events raised, for each state (Deleted
/ Modified
)
Obviously the lesser granular level would be OnDatabaseChangesApplied
, I guess.
Make sense ?
from dotmim.sync.
That being said, I just made some tests and the interceptor should not be called twice for each rows...
Can you provide me a sample to be able to reproduce your issue ?
from dotmim.sync.
Another thing to mention, if you are using bulk insert with SqlSyncProvider
, you could have a particular where the bulk method is called and tries to insert/update a bunch of rows, but it's failing for some reasons.
OnRowsChangesApplied
is called with all the rows failing and the explicit error (you can retrieve this error from the argument)
Then, DMS tries to applies all these rows, one by one. In some cases, applying rows one by row can resolve the issue.
OnRowsChangesApplied
is called a second time in this particular case.
Can you check if it's the case for you ?
from dotmim.sync.
Related Issues (20)
- Column name error HOT 6
- OutOfMemory exception when syncing huge tables for the first time HOT 14
- Insert in table with IDENTITY field fails HOT 13
- Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) HOT 5
- .net8 ? HOT 3
- DeleteMetadataAsync Not related with ScopeName
- The base table and the tracing table use different character set for the primary key, which greatly reduces the query performance HOT 5
- OnApplyChangesFailed method does not exist HOT 1
- .Net Standard 2.1 for use with Unity? HOT 9
- Upgrade 0.9.4 => 0.9.8. What to do with WebServerOrchestrator.OnTableChangesApplying & OnTableChangesSelected for setting/removing UserId HOT 1
- Can the last modified date be used globally to resolve conflicts? HOT 1
- logging HOT 1
- Unexpected end when deserializing array HOT 2
- ArgumentOutOfRangeException during sync. HOT 2
- Provisioning and Deprovisioning HOT 2
- Restoring SQL Server backup and sync
- Force sync in particular direction regardless? HOT 2
- SynchronousProgress<T> in WinUI 3/AppSdk app: The send method is not supported, use Post instead. HOT 1
- SQLLocalDB Supported? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotmim.sync.