Table of Contents

Class SimpleBuilderSettings

Namespace
Dapper.SimpleSqlBuilder
Assembly
Dapper.SimpleSqlBuilder.dll

Global settings for the builders.

public sealed class SimpleBuilderSettings

Inheritance

Properties

CollectionParameterTemplateFormat

Gets the template format used to create collection parameter names for the generated SQL.

public string CollectionParameterTemplateFormat { get; }

Property Value

string

DatabaseParameterNameTemplate

Gets the parameter name template used to create the parameter names for the generated SQL.

public string DatabaseParameterNameTemplate { get; }

Property Value

string

DatabaseParameterPrefix

Gets the parameter prefix used in the rendered SQL.

public string DatabaseParameterPrefix { get; }

Property Value

string

Instance

Singleton instance to access the builders settings.

public static SimpleBuilderSettings Instance { get; }

Property Value

SimpleBuilderSettings

ReuseParameters

Gets the value indicating whether to reuse parameters or not.

public bool ReuseParameters { get; }

Property Value

bool

UseLowerCaseClauses

Gets the value indicating whether SQL clauses should be in upper case or lower case.

public bool UseLowerCaseClauses { get; }

Property Value

bool

Methods

Configure(string?, string?, string?, bool?, bool?)

Configures the builders settings. null or empty arguments will be ignored.

public static void Configure(string? parameterNameTemplate = null, string? parameterPrefix = null, string? collectionParameterTemplateFormat = null, bool? reuseParameters = null, bool? useLowerCaseClauses = null)

Parameters

parameterNameTemplate string?

The parameter name template used to create the parameter names for the generated SQL. The default is p, so the parameter names will be generated as p0, p1, etc.

Example: Setting the template to param will generate param0, param1, etc.

parameterPrefix string?

The parameter prefix used in the rendered SQL. The default is @, so you will get @p0, @p1, etc.

Example: Setting the parameter prefix to : will generate :p0, :p1, etc.

collectionParameterTemplateFormat string?

The template format used to create collection parameter names for the generated SQL.

This template is used in conjunction with parameterNameTemplate to create parameter names for collections in the generated SQL.
The template must contain a single format placeholder {0} which will be replaced with an incrementing number.

The default is c{0}_; so if the parameterNameTemplate is p, the collection parameter names will be generated as pc0_, pc1_, etc.
When expanded into multiple parameters by Dapper, pc0_ will be expanded to pc0_1, pc0_2, etc.

Example: Setting the template to col{0} will generate pcol0, pcol1, etc.
reuseParameters bool?

The value indicating whether to reuse parameters or not. The default value is false.

Example: If set to true, parameters are reused; if set to false, they are not.

useLowerCaseClauses bool?

The value indicating whether to use lower case clauses for the fluent builder. The default value is false, meaning SQL clauses will be in upper case (e.g., SELECT, UPDATE, etc.).

Example: If set to true, SQL clauses will be in lower case (e.g., select, update, etc.).

The useLowerCaseClauses is only applicable to the fluent builder.

Exceptions

ArgumentException

Thrown when collectionParameterTemplateFormat is missing format placeholder.