{"id":31544454,"url":"https://github.com/aadipoddar/basesync","last_synced_at":"2026-03-03T19:32:29.741Z","repository":{"id":295112988,"uuid":"989010448","full_name":"aadipoddar/BaseSync","owner":"aadipoddar","description":"Libraru for syncing online and offline databases","archived":false,"fork":false,"pushed_at":"2025-05-24T09:45:42.000Z","size":642,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-25T11:03:29.269Z","etag":null,"topics":["csharp","databse","dotnet","sync"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/BaseSync/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aadipoddar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-23T12:20:07.000Z","updated_at":"2025-05-24T09:45:45.000Z","dependencies_parsed_at":"2025-05-23T18:09:17.751Z","dependency_job_id":"c8912caf-d845-4eac-a7ee-7b89ad50f259","html_url":"https://github.com/aadipoddar/BaseSync","commit_stats":null,"previous_names":["aadipoddar/basesync"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aadipoddar/BaseSync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aadipoddar%2FBaseSync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aadipoddar%2FBaseSync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aadipoddar%2FBaseSync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aadipoddar%2FBaseSync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aadipoddar","download_url":"https://codeload.github.com/aadipoddar/BaseSync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aadipoddar%2FBaseSync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30056068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","databse","dotnet","sync"],"created_at":"2025-10-04T13:16:32.883Z","updated_at":"2026-03-03T19:32:29.712Z","avatar_url":"https://github.com/aadipoddar.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# BaseSync\n\n![NuGet Version](https://img.shields.io/nuget/v/BaseSync.svg?style=flat\u0026label=NuGet)\n![Downloads](https://img.shields.io/nuget/dt/BaseSync.svg?style=flat\u0026label=Downloads)\n![License](https://img.shields.io/github/license/aadipoddar/BaseSync)\n![.NET](https://img.shields.io/badge/.NET-9.0-512BD4)\n\nA high-performance .NET library for bidirectional synchronization between online and offline SQL Server databases. BaseSync efficiently handles large datasets with 100,000+ rows through optimized bulk operations.\n\n## ✨ Features\n\n- **Bidirectional Synchronization**: Pull from remote to local, then push from local to remote\n- **High-Performance Design**: Optimized for large tables (100,000+ rows) using:\n  - Bulk insert operations with `SqlBulkCopy`\n  - Set-based updates via temporary tables\n  - Schema information caching\n- **Intelligent Comparison**: Only updates records that have actually changed\n- **Zero Configuration**: Automatically detects primary keys and table schemas\n- **Detailed Reports**: Comprehensive statistics for sync operations\n- **Error Handling**: Robust error handling with detailed feedback\n- **Async First**: Built with modern async patterns\n\n## 📦 Installation\n\nInstall via NuGet Package Manager:\n\n```\nInstall-Package BaseSync\n```\n\nOr via .NET CLI:\n\n```\ndotnet add package BaseSync\n```\n\n## 🚀 Quick Start\n\n\n```cs\nusing BaseSync;\n\n// Define connection strings\nstring localDb = \"Server=localhost;Database=LocalDB;Trusted_Connection=True;TrustServerCertificate=True;\";\nstring remoteDb = \"Server=remote-server;Database=RemoteDB;User Id=user;Password=password;TrustServerCertificate=True;\";\n\n// Specify tables to synchronize\nvar tables = new List\u003cstring\u003e { \"Customers\", \"Orders\", \"Products\" };\n\n// Perform synchronization\nSyncResult result = await BaseSync.SyncDataAsync(localDb, remoteDb, tables);\n\n// Check results\nforeach (var tableResult in result.TableResults) {\n\tConsole.WriteLine($\"Table: {tableResult.Key}\");\n\tif (tableResult.Value.IsSuccess) {\n\t\tConsole.WriteLine($\"  Pull: {tableResult.Value.PullInserts} inserts, {tableResult.Value.PullUpdates} updates\");\n\t\tConsole.WriteLine($\"  Push: {tableResult.Value.PushInserts} inserts, {tableResult.Value.PushUpdates} updates\");\n\t} else {\n\t\tConsole.WriteLine($\"  Error: {tableResult.Value.ErrorMessage}\");\n\t}\n}\n```\n\n\n## 🔄 How It Works\n\nBaseSync uses a sophisticated process to efficiently synchronize data:\n\n1. **Schema Discovery**: Automatically detects primary keys and columns for each table\n2. **Schema Caching**: Caches schema information to minimize database roundtrips\n3. **Data Retrieval**: Loads data from both source and destination databases\n4. **Memory-Efficient Comparison**: Creates dictionaries of destination rows indexed by primary key for O(1) lookups\n5. **Change Detection**: Identifies which rows need to be inserted or updated\n6. **Bulk Operations**:\n   - Uses `SqlBulkCopy` for fast insertion of new rows\n   - Creates temporary tables and performs set-based updates for changed rows\n7. **Bidirectional Sync**: First pulls from remote to local, then pushes from local to remote\n\n## 📊 Performance Optimizations\n\nBaseSync is engineered to handle large datasets efficiently:\n\n- **Reduced Database Roundtrips**: Performs bulk operations instead of row-by-row processing\n- **Memory Management**: Efficiently manages large datasets in memory\n- **Set-Based Operations**: Uses SQL's native strengths for updates via temp tables\n- **Caching**: Minimizes redundant schema queries\n\n## 🛠️ Requirements\n\n- .NET 9.0 or higher\n- SQL Server databases (source and destination)\n- Tables must have primary keys defined\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## 👨‍💻 About the Author\n\nBaseSync is developed and maintained by [AadiSoft](https://aadi.vercel.app/). \n\n## 📫 Contact\n\nFor any inquiries, please reach out to [contact@aadi.vercel.app](mailto:aadipoddarmail@gmail.com).\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003eBuilt with ❤️ by AadiSoft\u003c/sub\u003e\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faadipoddar%2Fbasesync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faadipoddar%2Fbasesync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faadipoddar%2Fbasesync/lists"}