AndroThink.Data.Harmonizer
1.0.0
dotnet add package AndroThink.Data.Harmonizer --version 1.0.0
NuGet\Install-Package AndroThink.Data.Harmonizer -Version 1.0.0
<PackageReference Include="AndroThink.Data.Harmonizer" Version="1.0.0" />
<PackageVersion Include="AndroThink.Data.Harmonizer" Version="1.0.0" />
<PackageReference Include="AndroThink.Data.Harmonizer" />
paket add AndroThink.Data.Harmonizer --version 1.0.0
#r "nuget: AndroThink.Data.Harmonizer, 1.0.0"
#:package AndroThink.Data.Harmonizer@1.0.0
#addin nuget:?package=AndroThink.Data.Harmonizer&version=1.0.0
#tool nuget:?package=AndroThink.Data.Harmonizer&version=1.0.0
AndroThink.Data.Harmonizer
AndroThink.Data.Harmonizer is a powerful .NET library designed to streamline data synchronization and reporting across multiple database providers. It provides a plug-and-play architecture for managing complex data ecosystems with built-in support for SQLite, SQL Server, and PostgreSQL.
🚀 Features
- Multi-Provider Support: Seamlessly switch between SQLite, SQL Server, and PostgreSQL via configuration.
- Automated Migrations: Simplified database initialization and migration management.
- Data Seeding: Built-in support for seeding initial synchronization system configurations.
- Reporting Services: Specialized services for generating and managing sync reports.
- Flexible Registration: Register the entire harmonizer suite with a single line of code.
🛠 Installation
Currently, this library is packaged as a Razor Class Library (RCL) or standard NuGet package. To use it, add the reference to your project:
dotnet add package AndroThink.Data.Harmonizer
⚙️ Configuration
The library expects a SyncDatabase section in your appsettings.json, usersecrets.json or EnvironmentVariables.
The structure varies slightly depending on the database type you choose.
SQLite Configuration
{
"SyncDatabase": {
"Type": "SQLite",
"Configuration": {
"DbPath": "Data/Harmonizer.db",
"SensitiveDataLogging": true,
"DbLogFilePath": "Logs/db_sync.log"
}
}
}
PostgreSQL Configuration
{
"SyncDatabase": {
"Type": "PostgreSQL",
"Configuration": {
"Host": "localhost",
"Port": 5432,
"DatabaseName": "HarmonizerDb",
"Username": "postgres",
"Password": "your_password",
"SensitiveDataLogging": false,
"SslMode": "Disable"
}
}
}
SQL Server Configuration
{
"SyncDatabase": {
"Type": "SQLServer",
"Configuration": {
"Server": ".",
"DatabaseName": "HarmonizerDb",
"Username": "sa",
"Password": "your_password",
"SensitiveDataLogging": true
}
}
}
📑 Usage
- Register ServicesIn your
Program.cs, use theAddDataHarmonizerextension method. This will automatically detect your database type from the configuration and register all necessary services.
var builder = WebApplication.CreateBuilder(args);
// To ensure your application discovers the controllers included in the library,
// add the following to your:
builder.Services.AddControllersWithViews()
.AddApplicationPart(typeof(AndroThink.Data.Harmonizer.Extension.StartupSetup).Assembly);
// Register the Harmonizer suite
builder.Services.AddDataHarmonizer(builder.Configuration);
- Initialize and Migrate DatabaseTo ensure your database is up-to-date and seeded with initial data, call the
MigrateDatabaseextension within a service scope.
var app = builder.Build();
using (var scope = app.Services.CreateScope())
{
// Optional: Define seeding data
var seedSystems = new List<SyncSystem>
{
new SyncSystem { Name = "Main Reporting Hub", BaseUrl = "https://api.reports.local" }
};
// Apply migrations and seed data
scope.MigrateDatabase(seedSystems);
}
app.Run();
🏛 Architecture & Services
When you call AddDataHarmonizer, the following services are injected into your Dependency Injection (DI) container:
| Interface | Implementation | Lifetime | Description |
|---|---|---|---|
| ISyncEndpointRegistry | SyncEndpointRegistry | Singleton | Manages the registry of all available sync endpoints. |
| ISyncSystemService | SyncSystemService | Scoped | Handles operations related to external sync system configurations. |
| ISyncReportService | SyncReportService | Scoped | Provides logic for generating and querying data reports. |
| EliteSyncContext | DbContext | Scoped | The primary Entity Framework Core context for the Harmonizer. |
🕹 Built-in Management API
AndroThink.Data.Harmonizer includes built-in controllers that provide a ready-to-use API for managing your synchronization and reporting ecosystem. Since the library is built as a Razor Class Library (RCL), these endpoints are integrated directly into your hosting application.
📡 API Endpoints
The library exposes the following RESTful endpoints to manage the reporting and synchronization lifecycle. By default, these are prefixed with /sync.
| Endpoint | Method | Description |
|---|---|---|
| /sync | GET | Base endpoint for triggering or checking the status of the harmonization process. |
| /sync/reports | GET | Retrieves logs, history, and generated data reports from the reporting database. |
| /sync/systems | GET | Manages the configuration of external systems (URLs, Names, and Connection states). |
🛠 Integration Tip: Routing
If your main application already uses a /sync route, you can adjust the library's routing behavior by using an Attribute Route or a Global Route Prefix in your hosting project.
To ensure the library's controllers are correctly mapped, verify your MapControllers configuration in Program.cs:
var app = builder.Build();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers(); // Required for /sync, /sync/reports, etc.
});
// or just use
app.MapDefaultControllerRoute();
app.Run();
🔍 Advanced: Manual Provider Registration
If you prefer to skip the appsettings.json automatic detection, you can register a specific provider directly:
// Example: Manual SQLite registration
builder.Services.AddDataHarmonizerSQLite(new SQLiteConfiguration {
DbPath = "my_custom_path.db",
SensitiveDataLogging = true
});
Note: This library uses a custom IModelCacheKeyFactory(SyncModelCacheKeyFactory) to handle dynamic schema adjustments during runtime, ensuring that reporting structures remain consistent across different sync sessions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- Microsoft.EntityFrameworkCore (>= 8.0.18)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.18)
- Microsoft.EntityFrameworkCore.Sqlite (>= 8.0.18)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.18)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.1)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 8.0.11)
- System.IO.Packaging (>= 10.0.7)
- System.Linq.Dynamic.Core (>= 1.7.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 |
|---|