namespace Dapper
{
partial class SqlMapper
{
///
/// Permits specifying certain SqlMapper values globally.
///
public static class Settings
{
static Settings()
{
SetDefaults();
}
///
/// Resets all Settings to their default values
///
public static void SetDefaults()
{
CommandTimeout = null;
ApplyNullValues = false;
}
///
/// Specifies the default Command Timeout for all Queries
///
public static int? CommandTimeout { get; set; }
///
/// Indicates whether nulls in data are silently ignored (default) vs actively applied and assigned to members
///
public static bool ApplyNullValues { get; set; }
///
/// Should list expansions be padded with null-valued parameters, to prevent query-plan saturation? For example,
/// an 'in @foo' expansion with 7, 8 or 9 values will be sent as a list of 10 values, with 3, 2 or 1 of them null.
/// The padding size is relative to the size of the list; "next 10" under 150, "next 50" under 500,
/// "next 100" under 1500, etc.
///
///
/// Caution: this should be treated with care if your DB provider (or the specific configuration) allows for null
/// equality (aka "ansi nulls off"), as this may change the intent of your query; as such, this is disabled by
/// default and must be enabled.
///
public static bool PadListExpansions { get; set; }
///
/// If set (non-negative), when performing in-list expansions of integer types ("where id in @ids", etc), switch to a string_split based
/// operation if there are more than this many elements. Note that this feautre requires SQL Server 2016 / compatibility level 130 (or above).
///
public static int InListStringSplitCount { get; set; } = -1;
}
}
}