DatabaseMaintenance 1.0.8
dotnet add package DatabaseMaintenance --version 1.0.8
NuGet\Install-Package DatabaseMaintenance -Version 1.0.8
<PackageReference Include="DatabaseMaintenance" Version="1.0.8" />
paket add DatabaseMaintenance --version 1.0.8
#r "nuget: DatabaseMaintenance, 1.0.8"
// Install DatabaseMaintenance as a Cake Addin #addin nuget:?package=DatabaseMaintenance&version=1.0.8 // Install DatabaseMaintenance as a Cake Tool #tool nuget:?package=DatabaseMaintenance&version=1.0.8
DatabaseMaintenance
DatabaseMaintenance is a .NET library designed for managing and optimizing database maintenance tasks, including index optimization and script execution. This library provides a flexible interface for configuring and running various maintenance operations with ease.
Kudos
A special thanks to Ola Hallengren for his exceptional work on SQL Server maintenance solutions. His scripts serve as the foundation for this library, which aims to simplify and enhance database maintenance tasks.
Why This Library?
In modern applications, maintaining database performance is crucial. As databases grow and evolve, regular maintenance tasks such as index optimization become necessary to ensure efficient data access and query performance. This library encapsulates common maintenance tasks, providing developers with an easy-to-use interface to manage these processes programmatically.
Quick Start Guide
Installation
You can install the
DatabaseMaintenance
library via NuGet Package Manager:dotnet add package DatabaseMaintenance
Usage
Here’s a basic example of how to use the DatabaseClient and IndexOptions classes to perform index optimization:
using DatabaseMaintenance; var options = new IndexOptions { FragmentationLevel2 = 50, // Customize your options here Databases = "YourDatabaseName" }; var dbClient = new DatabaseClient("YourConnectionString"); // Optional: Create a CancellationTokenSource for canceling long-running tasks var cts = new CancellationTokenSource(); try { await dbClient.ExecuteIndexOptimizeProcedure(options, Console.WriteLine, cts.Token); } catch (OperationCanceledException) { Console.WriteLine("Operation was canceled."); } catch (Exception ex) { Console.WriteLine($"An error occurred: {ex.Message}"); }
Key Features
Customizable Options:
- Set various parameters for index optimization through the
IndexOptions
object, allowing you to tailor maintenance operations to your specific database needs.
- Set various parameters for index optimization through the
Cancellation Tokens:
- Easily manage long-running operations with
CancellationToken
. This feature enables you to cancel the execution of maintenance tasks if they exceed your desired time limits, providing flexibility in managing long-running queries.
- Easily manage long-running operations with
No Connection Timeouts:
- All connection timeouts have been removed, ensuring that operations can wait indefinitely for completion without unexpected interruptions, allowing for smoother execution of database maintenance tasks.
Easy Integration:
- Simple installation via NuGet and straightforward usage patterns make it easy to incorporate into existing .NET applications, enhancing your database management capabilities with minimal effort.
Logging Capabilities:
- Output messages and logs during execution can be captured and displayed, facilitating debugging and monitoring of maintenance tasks. For now you need to parse the result yourselves.
Conclusion
The DatabaseMaintenance
library provides a robust solution for efficiently managing SQL Server maintenance tasks. By leveraging the well-established work of Ola Hallengren, this library simplifies the complex process of ensuring optimal database performance. With its customizable options, cancellation capabilities, and seamless integration into .NET applications, this library serves as an essential tool for developers looking to maintain their databases effectively and reliably.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Data.SqlClient (>= 5.2.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.8 | 46 | 11/25/2024 |
1.0.8-PullRequest9.5 | 30 | 11/25/2024 |
1.0.6 | 43 | 11/25/2024 |
1.0.6-PullRequest8.2 | 28 | 11/25/2024 |
1.0.5 | 82 | 10/25/2024 |
1.0.5-PullRequest6.2 | 34 | 10/25/2024 |
1.0.4 | 72 | 10/25/2024 |
1.0.4-PullRequest4.4 | 29 | 10/25/2024 |
1.0.4-PullRequest4.3 | 29 | 10/25/2024 |
1.0.4-PullRequest4.2 | 29 | 10/25/2024 |
1.0.3 | 66 | 10/24/2024 |
1.0.3-PullRequest3.2 | 28 | 10/24/2024 |
1.0.2 | 69 | 10/24/2024 |
1.0.2-PullRequest2.2 | 30 | 10/24/2024 |
1.0.1-PullRequest1.2 | 31 | 10/24/2024 |
0.0.1 | 1,924 | 10/24/2024 |