DbSyncKit can be configured manually without using Dependency Injection (DI). This guide outlines the steps to set up DbSyncKit manually in your application.
1. Query Generator Setup (Optional)
For MSSQL
API Reference: QueryGenerator
IQueryGenerator queryGenerator = new DbSyncKit.MSSQL.QueryGenerator();
For MySQL
API Reference: QueryGenerator
IQueryGenerator queryGenerator = new DbSyncKit.MySQL.QueryGenerator();
For PostgreSQL
API Reference: QueryGenerator
IQueryGenerator queryGenerator = new DbSyncKit.PostgreSQL.QueryGenerator();
For SQLite
API Reference: QueryGenerator
IQueryGenerator queryGenerator = new DbSyncKit.SQLite.QueryGenerator();
2. Synchronization Setup
To set up the synchronization process manually, you'll need to create instances of DbSyncKit components.
API Reference: Synchronization
// manual synchronization setup
Synchronization Sync = new Synchronization();
3. Database Configuration
Configure your source and destination databases using DbSyncKit's IDatabase interface.
For MSSQL
Api Ref: Connection
// MSSQL manual database configuration
IDatabase SourceDatabase = new DbSyncKit.MSSQL.Connection("(localdb)\\MSSQLLocalDB", true, "SourceChinook");
IDatabase DestinationDatabase = new DbSyncKit.MSSQL.Connection("(localdb)\\MSSQLLocalDB", true, "DestinationChinook");
For MySQL
Api Ref: Connection
// MySQL manual database configuration
IDatabase SourceDatabase = new DbSyncKit.MySQL.Connection("localhost", 3306, "SourceChinook", "root", "");
IDatabase DestinationDatabase = new DbSyncKit.MySQL.Connection("localhost", 3306, "DestinationChinook", "root", "");
For PostgreSQL
Api Ref: Connection
// MySQL manual database configuration
IDatabase SourceDatabase = new DbSyncKit.PostgreSQL.Connection("localhost", 5432, "sourceChinook", "postgres", "");
IDatabase DestinationDatabase = new DbSyncKit.PostgreSQL.Connection("localhost", 5432, "destinationChinook", "postgres", "");
For SQLite
Api Ref: Connection
// SQLite manual database configuration
IDatabase SourceDatabase = new DbSyncKit.SQLite.Connection(Path.Combine("Path", "to", "sourceChinook.sqlite"));
IDatabase DestinationDatabase = new DbSyncKit.SQLite.Connection(Path.Combine("Path", "to", "destinationChinook.sqlite"));
Replace connection strings and other details according to your actual configurations.
4. Start Synchronization
Once everything is set up, you can start the synchronization process.
Proceed to the Usage Guide to learn how to perform synchronization tasks with DbSyncKit.
Note
Manual setup provides more control but may require additional configuration compared to Dependency Injection (DI).