DataCrud.DBOps is a premium, high-performance database maintenance and job orchestration library for .NET. Designed to bridge the gap between modern cloud-native architectures and legacy enterprise systems, it provides a unified interface for database backups, index optimization, and real-time operational monitoring.
- β‘ Intelligent Maintenance: Automated database shrinking and sophisticated index management (Reorganize/Rebuild) to ensure peak performance.
- π‘οΈ Resilient Backups: Automated full-database backup workflows with high-ratio compression and integrity verification.
- βοΈ Multi-Cloud Sync: Native, high-performance integration with AWS S3 and Azure Blob Storage for off-site redundancy.
- π Embedded Dashboard: A stunning, lightweight operational dashboard built with HTMX and Alpine.js, providing real-time job control and log visibility.
- π Centralized Logging: Robust
IJobStoragearchitecture supporting SQL Server and LiteDB, featuring parent/child log relationships for granular auditing. - π Cross-Platform Heritage: First-class support for ASP.NET Core (DI-friendly) and Legacy .NET Framework (OWIN/Console).
Unlike traditional maintenance scripts, DBOps utilizes a centralized orchestration engine. All database providers report to a unified IJobStorage backend, ensuring that your maintenance history is consistent across all servers.
- Parent Logs: Summary of job type, execution status, and duration.
- Child Logs: Detailed execution traces, warnings, and error stack traces for every step of the process.
Install the core and your preferred provider via NuGet:
dotnet add package DataCrud.DBOps.AspNetCore
dotnet add package DataCrud.DBOps.SqlServerConfigure with Dependency Injection:
builder.Services.AddDBOps(options =>
{
// Configure Storage (Centralized History)
options.Storage = new SqlServerJobStorage("YourHistoryDbConnectionString");
// Multi-Cloud Sync
options.PushToAws = true;
options.AwsBucketName = "bucket-name";
options.AwsRegion = "us-east-1";
});DBOps is designed to manage multiple database instances (and different providers) simultaneously from a single dashboard.
builder.Services.AddDBOps(options =>
{
options.Storage = new LiteDbJobStorage("history.db");
// --- Zipping Configuration ---
options.EnableZipping = true; // Set false to skip compression (default: true)
options.BackupPath = "C:\\Backups"; // Custom local staging directory
// --- Azure Storage Configuration ---
// Backups will be pushed to the 'backups' container in 'databases/' folder
options.PushToAzure = true;
options.AzureStorageConnectionString = "DefaultEndpointsProtocol=https;AccountName=...";
// --- AWS S3 Configuration ---
options.PushToAws = true;
options.AwsAccessKey = "YOUR-ACCESS-KEY";
options.AwsSecretKey = "YOUR-SECRET-KEY";
options.AwsBucketName = "your-bucket-name";
options.AwsRegion = "us-east-1";
// --- Multi-Server Registration ---
options.Providers.Add(new SqlServerProvider("ConnString1", "Production ERP"));
options.Providers.Add(new PostgresProvider("PostgresConn", "Analytics App"));
// Enable "Discovery Mode" to automatically find all DBs on a server
options.Providers.Add(new SqlServerProvider("ServerConn", "Main Cluster", discover: true));
});For legacy applications, install the AspNet integration:
Install-Package DataCrud.DBOps.AspNetConfigure in your Startup.cs:
public void Configuration(IAppBuilder app)
{
app.UseDBOps(options =>
{
options.DashboardPath = "/dbops";
options.Storage = new LiteDbJobStorage("jobs_dbops.db");
// Register your database providers
options.Providers.Add(new SqlServerProvider("YourConnectionString", "Data Server 01"));
});
}Access the premium dashboard by mapping the middleware in your startup:
app.UseDatabaseOpsDashboard(options =>
{
options.Path = "/dbops";
options.Security.RequireAdminRole = true;
});DBOps is secure by default. You can configure authentication for the dashboard using several methods:
The simplest way to protect your dashboard is using the built-in Basic Auth.
options.Security.Enabled = true; // Enabled by default
options.Security.Username = "admin";
options.Security.Password = "strong-password-here";If your application uses ASP.NET Identity or OWIN Security, you can restrict access to specific roles:
options.Security.AllowedRoles = new[] { "Administrator", "DBManager" };For advanced security requirements (IP filtering, custom headers, etc.), implement IDBOpsAuthorizationFilter:
options.Security.AuthorizationFilters.Add(new MyCustomAuthFilter());You can easily automate your database maintenance using popular schedulers like Hangfire or native .NET Background Services.
// In your Startup or Program.cs
RecurringJob.AddOrUpdate<MaintenanceManager>(
"daily-backup",
manager => manager.RunAsync("MyDatabase", true, true, true, true, true, "C:\\Backups", 7, true, null, default),
Cron.Daily
);public class DatabaseBackupWorker : BackgroundService
{
private readonly IServiceProvider _serviceProvider;
public DatabaseBackupWorker(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
using (var scope = _serviceProvider.CreateScope())
{
var manager = scope.ServiceProvider.GetRequiredService<MaintenanceManager>();
await manager.RunAsync("MyDatabase", backup: true, shrink: true, index: true,
reorganize: true, cleanup: true, backupDir: "C:\\Backups");
}
// Wait 24 hours
await Task.Delay(TimeSpan.FromHours(24), stoppingToken);
}
}
}DataCrud.DBOps is maintained for enterprise-grade stability. For custom provider development or specialized cloud integrations, please reach out to the DataCrud team.
This project is licensed under the MIT License. See the LICENSE file for details.