BaseSync 1.0.0
dotnet add package BaseSync --version 1.0.0
NuGet\Install-Package BaseSync -Version 1.0.0
<PackageReference Include="BaseSync" Version="1.0.0" />
<PackageVersion Include="BaseSync" Version="1.0.0" />
<PackageReference Include="BaseSync" />
paket add BaseSync --version 1.0.0
#r "nuget: BaseSync, 1.0.0"
#:package BaseSync@1.0.0
#addin nuget:?package=BaseSync&version=1.0.0
#tool nuget:?package=BaseSync&version=1.0.0
BaseSync
A 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.
✨ Features
- Bidirectional Synchronization: Pull from remote to local, then push from local to remote
- High-Performance Design: Optimized for large tables (100,000+ rows) using:
- Bulk insert operations with
SqlBulkCopy
- Set-based updates via temporary tables
- Schema information caching
- Bulk insert operations with
- Intelligent Comparison: Only updates records that have actually changed
- Zero Configuration: Automatically detects primary keys and table schemas
- Detailed Reports: Comprehensive statistics for sync operations
- Error Handling: Robust error handling with detailed feedback
- Async First: Built with modern async patterns
📦 Installation
Install via NuGet Package Manager:
Install-Package BaseSync
Or via .NET CLI:
dotnet add package BaseSync
🚀 Quick Start
using BaseSync;
// Define connection strings
string localDb = "Server=localhost;Database=LocalDB;Trusted_Connection=True;TrustServerCertificate=True;";
string remoteDb = "Server=remote-server;Database=RemoteDB;User Id=user;Password=password;TrustServerCertificate=True;";
// Specify tables to synchronize
var tables = new List<string> { "Customers", "Orders", "Products" };
// Perform synchronization
SyncResult result = await BaseSync.SyncDataAsync(localDb, remoteDb, tables);
// Check results
foreach (var tableResult in result.TableResults) {
Console.WriteLine($"Table: {tableResult.Key}");
if (tableResult.Value.IsSuccess) {
Console.WriteLine($" Pull: {tableResult.Value.PullInserts} inserts, {tableResult.Value.PullUpdates} updates");
Console.WriteLine($" Push: {tableResult.Value.PushInserts} inserts, {tableResult.Value.PushUpdates} updates");
} else {
Console.WriteLine($" Error: {tableResult.Value.ErrorMessage}");
}
}
🔄 How It Works
BaseSync uses a sophisticated process to efficiently synchronize data:
- Schema Discovery: Automatically detects primary keys and columns for each table
- Schema Caching: Caches schema information to minimize database roundtrips
- Data Retrieval: Loads data from both source and destination databases
- Memory-Efficient Comparison: Creates dictionaries of destination rows indexed by primary key for O(1) lookups
- Change Detection: Identifies which rows need to be inserted or updated
- Bulk Operations:
- Uses
SqlBulkCopy
for fast insertion of new rows - Creates temporary tables and performs set-based updates for changed rows
- Uses
- Bidirectional Sync: First pulls from remote to local, then pushes from local to remote
📊 Performance Optimizations
BaseSync is engineered to handle large datasets efficiently:
- Reduced Database Roundtrips: Performs bulk operations instead of row-by-row processing
- Memory Management: Efficiently manages large datasets in memory
- Set-Based Operations: Uses SQL's native strengths for updates via temp tables
- Caching: Minimizes redundant schema queries
🛠️ Requirements
- .NET 9.0 or higher
- SQL Server databases (source and destination)
- Tables must have primary keys defined
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 About the Author
BaseSync is developed and maintained by AadiSoft.
📫 Contact
For any inquiries, please reach out to contact@aadi.vercel.app.
<div align="center"> <sub>Built with ❤️ by AadiSoft</sub> </div>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Data.SqlClient (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 74 | 5/24/2025 |
First release functional and fast merging with Bulk update and insert