using Dotmim.Sync.SqlServer;
using Dotmim.Sync.Sqlite;
using Microsoft.Data.Sqlite;
using System.Threading.Tasks;
public static async Task Main()
await SynchronizeAsync();
await QueryClientDatabaseAsync();
private static async Task SynchronizeAsync()
var serverProvider = new SqlSyncProvider(FiddleHelper.GetConnectionStringSqlServerNorthwind());
var clientProvider = new SqliteSyncProvider("northwind.db");
var setup = new SyncSetup("Customers", "Products", "Orders", "Order Details");
var agent = new SyncAgent(clientProvider, serverProvider);
var progress = new SynchronousProgress<ProgressArgs>(s =>
Console.WriteLine($"{s.ProgressPercentage:p}: \t[{s?.Source[..Math.Min(4, s.Source.Length)]}] {s.TypeName}: {s.Message}"));
var result = await agent.SynchronizeAsync(setup);
Console.WriteLine(result);
private static async Task QueryClientDatabaseAsync()
Console.WriteLine("-------------------");
using (var sqliteConnection = new SqliteConnection("Data Source=northwind.db"))
using (var sqlCommand = new SqliteCommand("Select * from Customers", sqliteConnection))
await sqliteConnection.OpenAsync();
var reader = await sqlCommand.ExecuteReaderAsync();
Console.WriteLine($"{reader.GetString(2)}:\t{reader.GetString(3)}");
sqliteConnection.Close();