ISM.Database.SQLServer 1.0.20
I.S.M. Database SQLServer
🏷️ Introduction
This package provides a SQL Server database configuration for the I.S.M. Database library. It allows you to easily set up and manage your SQL Server database connections, including support for retry logic on transient errors in production environments.
🛠️ Configuration
To configure the database connection, you can use the following connection string format in your application's configuration file (e.g., appsettings.json):
{
"ConnectionStrings": {
"SqlConnection": "Server=your_server;Database=your_database;User Id=your_username;Password=your_password;"
}
}
[!TIP] The list of additional SQL error numbers to consider transient can be used to specify any custom error codes that your application may encounter and want to treat as transient errors for retry logic.
And to configure SQL Server specific settings, you can add the following section to your configuration file:
{
"SQLServerSettings": {
"MigrationAssembly": "YourProject.Migrations",
"Environment": "Development", // or "Staging" or "Production"
"CompatibilityLevel": 160, // SQL Server 2022
// The settings below are used for retry logic on transient errors in production environment only.
"CommandTimeout": 180, // in seconds
"MaxRetryCount": 5, // number of retry attempts for transient failures
"MaxRetryDelay": "00:00:10", // maximum delay between retries (10 seconds)
"ErrorNumbersToAdd": [] // list of additional SQL error numbers to consider transient
}
}
[!NOTE] The list is available in this Microsoft learn article and can be used to enhance the robustness of your application's database interactions by allowing you to specify additional error codes that should trigger retry logic.
In your application's startup code (e.g., Program.cs), you can retrieve the connection string and SQL Server settings from the configuration and create the SQL Server configuration object as follows:
var connectionString = builder.Configuration.GetConnectionString("SqlConnection")!;
var sqlServerSettings = builder.Services.ConfigureAndGet<SQLServerSettings>(builder.Configuration, nameof(SQLServerSettings));
var sqlServerConfiguration = GetSQLServerConfiguration(builder, connectionString, sqlServerSettings);
Finally in the DbContext configuration it is necessary to add the relevant configuration.
builder.Services.AddDbContext<YourDbContext>(options =>
{
options.UseSQLServerConfiguration(sqlServerConfiguration);
});
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
No packages depend on ISM.Database.SQLServer.
.NET 10.0
- EntityFrameworkCore.Exceptions.SqlServer (>= 10.0.0)
- ISM.Shared (>= 1.0.21)
- Microsoft.EntityFrameworkCore (>= 10.0.8)
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.8)
- TinyAppEngine (>= 1.0.43)
| Version | Downloads | Last updated |
|---|---|---|
| 1.0.30 | 1 | 07/05/2026 |
| 1.0.29 | 4 | 06/15/2026 |
| 1.0.27 | 6 | 06/04/2026 |
| 1.0.26 | 7 | 05/24/2026 |
| 1.0.25 | 4 | 05/22/2026 |
| 1.0.24 | 3 | 05/20/2026 |
| 1.0.23 | 5 | 05/19/2026 |
| 1.0.22 | 6 | 05/17/2026 |
| 1.0.21 | 2 | 05/16/2026 |
| 1.0.20 | 2 | 05/14/2026 |
| 1.0.19 | 10 | 05/09/2026 |
| 1.0.17 | 1 | 05/08/2026 |
| 1.0.16 | 4 | 05/08/2026 |
| 1.0.15 | 8 | 05/03/2026 |
| 1.0.11 | 3 | 05/02/2026 |
| 1.0.6 | 10 | 04/30/2026 |
| 1.0.5 | 5 | 04/29/2026 |
| 1.0.1 | 0 | 04/26/2026 |