AndroThink.Data.Harmonizer 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package AndroThink.Data.Harmonizer --version 1.0.0
                    
NuGet\Install-Package AndroThink.Data.Harmonizer -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AndroThink.Data.Harmonizer" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AndroThink.Data.Harmonizer" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AndroThink.Data.Harmonizer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AndroThink.Data.Harmonizer --version 1.0.0
                    
#r "nuget: AndroThink.Data.Harmonizer, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AndroThink.Data.Harmonizer@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AndroThink.Data.Harmonizer&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AndroThink.Data.Harmonizer&version=1.0.0
                    
Install as a Cake Tool

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

  1. Register ServicesIn your Program.cs, use the AddDataHarmonizer extension 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);
  1. Initialize and Migrate DatabaseTo ensure your database is up-to-date and seeded with initial data, call the MigrateDatabase extension 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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