61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
using System;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace SDA.DataProvider.Wrappers.MSSQL
|
|
{
|
|
internal class MSSQLConnectionStringBuilderWrapper : IDisposable
|
|
{
|
|
SqlConnectionStringBuilder builder;
|
|
|
|
public MSSQLConnectionStringBuilderWrapper(string connectionstring)
|
|
{
|
|
builder = new SqlConnectionStringBuilder(connectionstring);
|
|
|
|
GenerateConnectionString();
|
|
}
|
|
|
|
public string ConnectionString
|
|
{
|
|
get
|
|
{
|
|
return builder.ConnectionString;
|
|
}
|
|
set
|
|
{
|
|
builder.ConnectionString = value;
|
|
|
|
GenerateConnectionString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// ha megvan adva ConnectionTimeout a konfigban, akkor felülírja a connection stringet
|
|
/// </summary>
|
|
void GenerateConnectionString()
|
|
{
|
|
if (Configuration.ConnectionTimeout.HasValue
|
|
&& builder.ConnectionString.IndexOf("Connect Timeout", StringComparison.OrdinalIgnoreCase) == -1)
|
|
{
|
|
ConnectionTimeout = Configuration.ConnectionTimeout.Value;
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
builder = null;
|
|
}
|
|
|
|
public int ConnectionTimeout
|
|
{
|
|
get
|
|
{
|
|
return builder.ConnectTimeout;
|
|
}
|
|
set
|
|
{
|
|
builder.ConnectTimeout = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|