Link Search Menu Expand Document

BaseDbSetting


This class is the base class of all IDbSetting-based classes.

Use-Cases

Use this class instead of the IDbSetting interface when overriding default database settings.

How to Implement?

Create a class that inherits this class and set the properties in the constructor.

public sealed class MyCustomSqlServerDbSetting : BaseDbSetting
{
    public MyCustomSqlServerDbSetting()
        : base()
    {
        AreTableHintsSupported = true;
        AverageableType = typeof(double);
        ClosingQuote = "]";
        DefaultSchema = "dbo";
        IsDirectionSupported = true;
        IsExecuteReaderDisposable = true;
        IsMultiStatementExecutable = true;
        IsPreparable = true;
        IsUseUpsert = false;
        OpeningQuote = "[";
        ParameterPrefix = "@";
        SchemaSeparator = ".";
    }
}

This class already implements GetHashCode(), so no override is required.

Usability

Use the DbSettingMapper class to map the setting to a specific RDBMS provider.

DbSettingMapper.Add(typeof(SqlConnection), new MyCustomSqlServerDbSetting(), true);