RelationalSqlGenerationHelper RelationalSqlGenerationHelper Class

Definition

Provides services to help with generation of SQL commands.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public class RelationalSqlGenerationHelper : ISqlGenerationHelper
Public Class RelationalSqlGenerationHelper
    Implements ISqlGenerationHelper
Inheritance
System.ObjectSystem.Object
RelationalSqlGenerationHelperRelationalSqlGenerationHelper
Implements

Properties

BatchTerminator BatchTerminator

The terminator to be used for batches of SQL statements.

public virtual string BatchTerminator { get; }
Public Overridable ReadOnly Property BatchTerminator As String
Value
System.String System.String

DateTimeFormat DateTimeFormat

Gets the date time format.

protected virtual string DateTimeFormat { get; }
Protected Overridable ReadOnly Property DateTimeFormat As String
Value
System.String System.String

DateTimeFormatString DateTimeFormatString

Gets the date time format.

protected virtual string DateTimeFormatString { get; }
Protected Overridable ReadOnly Property DateTimeFormatString As String
Value
System.String System.String

DateTimeOffsetFormat DateTimeOffsetFormat

Gets the date time offset format.

protected virtual string DateTimeOffsetFormat { get; }
Protected Overridable ReadOnly Property DateTimeOffsetFormat As String
Value
System.String System.String

DateTimeOffsetFormatString DateTimeOffsetFormatString

Gets the date time offset format.

protected virtual string DateTimeOffsetFormatString { get; }
Protected Overridable ReadOnly Property DateTimeOffsetFormatString As String
Value
System.String System.String

DecimalFormat DecimalFormat

Gets the decimal format.

protected virtual string DecimalFormat { get; }
Protected Overridable ReadOnly Property DecimalFormat As String
Value
System.String System.String

DecimalFormatString DecimalFormatString

Gets the decimal format.

protected virtual string DecimalFormatString { get; }
Protected Overridable ReadOnly Property DecimalFormatString As String
Value
System.String System.String

FloatingPointFormatString FloatingPointFormatString

Gets the floating point format.

protected virtual string FloatingPointFormatString { get; }
Protected Overridable ReadOnly Property FloatingPointFormatString As String
Value
System.String System.String

StatementTerminator StatementTerminator

The terminator to be used for SQL statements.

public virtual string StatementTerminator { get; }
Public Overridable ReadOnly Property StatementTerminator As String
Value
System.String System.String

Methods

DelimitIdentifier(String) DelimitIdentifier(String)

Generates the delimited SQL representation of an identifier (column name, table name, etc.).

public virtual string DelimitIdentifier(string identifier)
Public Overridable Function DelimitIdentifier(identifier As String) As String
Parameters
identifier
System.String System.String

The identifier to delimit.

Returns
System.String System.String

The generated string.

DelimitIdentifier(String, String) DelimitIdentifier(String, String)

Generates the delimited SQL representation of an identifier (column name, table name, etc.).

public virtual string DelimitIdentifier(string name, string schema)
Public Overridable Function DelimitIdentifier(name As String, schema As String) As String
Parameters
name
System.String System.String

The identifier to delimit.

schema
System.String System.String

The schema of the identifier.

Returns
System.String System.String

The generated string.

DelimitIdentifier(StringBuilder, String) DelimitIdentifier(StringBuilder, String)

Writes the delimited SQL representation of an identifier (column name, table name, etc.).

public virtual void DelimitIdentifier(StringBuilder builder, string identifier)
Public Overridable Sub DelimitIdentifier(builder As StringBuilder, identifier As String)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

identifier
System.String System.String

The identifier to delimit.

DelimitIdentifier(StringBuilder, String, String) DelimitIdentifier(StringBuilder, String, String)

Writes the delimited SQL representation of an identifier (column name, table name, etc.).

public virtual void DelimitIdentifier(StringBuilder builder, string name, string schema)
Public Overridable Sub DelimitIdentifier(builder As StringBuilder, name As String, schema As String)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

name
System.String System.String

The identifier to delimit.

schema
System.String System.String

The schema of the identifier.

Equals(Object) Equals(Object)

Inherited from System.Object

Equals(Object, Object) Equals(Object, Object)

Inherited from System.Object

EscapeIdentifier(String) EscapeIdentifier(String)

Generates the escaped SQL representation of an identifier (column name, table name, etc.).

public virtual string EscapeIdentifier(string identifier)
Public Overridable Function EscapeIdentifier(identifier As String) As String
Parameters
identifier
System.String System.String

The identifier to be escaped.

Returns
System.String System.String

The generated string.

EscapeIdentifier(StringBuilder, String) EscapeIdentifier(StringBuilder, String)

Writes the escaped SQL representation of an identifier (column name, table name, etc.).

public virtual void EscapeIdentifier(StringBuilder builder, string identifier)
Public Overridable Sub EscapeIdentifier(builder As StringBuilder, identifier As String)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

identifier
System.String System.String

The identifier to be escaped.

EscapeLiteral(String) EscapeLiteral(String)

Generates the escaped SQL representation of a literal value.

public virtual string EscapeLiteral(string literal)
Public Overridable Function EscapeLiteral(literal As String) As String
Parameters
literal
System.String System.String

The value to be escaped.

Returns
System.String System.String

The generated string.

EscapeLiteral(StringBuilder, String) EscapeLiteral(StringBuilder, String)

Writes the escaped SQL representation of a literal value.

public virtual void EscapeLiteral(StringBuilder builder, string literal)
Public Overridable Sub EscapeLiteral(builder As StringBuilder, literal As String)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

literal
System.String System.String

The value to be escaped.

GenerateLiteral(Object, RelationalTypeMapping) GenerateLiteral(Object, RelationalTypeMapping)

Generates the SQL representation of a literal value.

public virtual string GenerateLiteral(object value, RelationalTypeMapping typeMapping = null)
Public Overridable Function GenerateLiteral(value As Object, typeMapping As RelationalTypeMapping = Nothing) As String
Parameters
value
System.Object System.Object

The literal value.

typeMapping
RelationalTypeMapping RelationalTypeMapping

An optional type mapping that is used for this value.

Returns
System.String System.String

The generated string.

GenerateLiteral(StringBuilder, Object, RelationalTypeMapping) GenerateLiteral(StringBuilder, Object, RelationalTypeMapping)

Writes the SQL representation of a literal value.

public virtual void GenerateLiteral(StringBuilder builder, object value, RelationalTypeMapping typeMapping = null)
Public Overridable Sub GenerateLiteral(builder As StringBuilder, value As Object, typeMapping As RelationalTypeMapping = Nothing)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Object System.Object

The literal value.

typeMapping
RelationalTypeMapping RelationalTypeMapping

An optional type mapping that is used for this value.

GenerateLiteralValue(Boolean) GenerateLiteralValue(Boolean)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(bool value)
Protected Overridable Function GenerateLiteralValue(value As Boolean) As String
Parameters
value
System.Boolean System.Boolean

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Byte) GenerateLiteralValue(Byte)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(byte value)
Protected Overridable Function GenerateLiteralValue(value As Byte) As String
Parameters
value
System.Byte System.Byte

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Byte[]) GenerateLiteralValue(Byte())

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(byte[] value)
Protected Overridable Function GenerateLiteralValue(value As Byte()) As String
Parameters
value
System.Byte[] System.Byte()

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Char) GenerateLiteralValue(Char)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(char value)
Protected Overridable Function GenerateLiteralValue(value As Char) As String
Parameters
value
System.Char System.Char

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(DateTime) GenerateLiteralValue(DateTime)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(DateTime value)
Protected Overridable Function GenerateLiteralValue(value As Date) As String
Parameters
value
System.DateTime System.DateTime

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(DateTimeOffset) GenerateLiteralValue(DateTimeOffset)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(DateTimeOffset value)
Protected Overridable Function GenerateLiteralValue(value As DateTimeOffset) As String
Parameters
value
System.DateTimeOffset System.DateTimeOffset

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(DbType) GenerateLiteralValue(DbType)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(DbType value)
Protected Overridable Function GenerateLiteralValue(value As DbType) As String
Parameters
value
System.Data.DbType System.Data.DbType

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Decimal) GenerateLiteralValue(Decimal)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(decimal value)
Protected Overridable Function GenerateLiteralValue(value As Decimal) As String
Parameters
value
System.Decimal System.Decimal

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Double) GenerateLiteralValue(Double)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(double value)
Protected Overridable Function GenerateLiteralValue(value As Double) As String
Parameters
value
System.Double System.Double

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Enum) GenerateLiteralValue(Enum)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(Enum value)
Protected Overridable Function GenerateLiteralValue(value As  Enum) As String
Parameters
value
System.Enum System.Enum

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Guid) GenerateLiteralValue(Guid)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(Guid value)
Protected Overridable Function GenerateLiteralValue(value As Guid) As String
Parameters
value
System.Guid System.Guid

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Int16) GenerateLiteralValue(Int16)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(short value)
Protected Overridable Function GenerateLiteralValue(value As Short) As String
Parameters
value
System.Int16 System.Int16

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Int32) GenerateLiteralValue(Int32)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(int value)
Protected Overridable Function GenerateLiteralValue(value As Integer) As String
Parameters
value
System.Int32 System.Int32

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Int64) GenerateLiteralValue(Int64)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(long value)
Protected Overridable Function GenerateLiteralValue(value As Long) As String
Parameters
value
System.Int64 System.Int64

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Object) GenerateLiteralValue(Object)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(object value)
Protected Overridable Function GenerateLiteralValue(value As Object) As String
Parameters
value
System.Object System.Object

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(Single) GenerateLiteralValue(Single)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(float value)
Protected Overridable Function GenerateLiteralValue(value As Single) As String
Parameters
value
System.Single System.Single

The literal value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(String, RelationalTypeMapping) GenerateLiteralValue(String, RelationalTypeMapping)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(string value, RelationalTypeMapping typeMapping)
Protected Overridable Function GenerateLiteralValue(value As String, typeMapping As RelationalTypeMapping) As String
Parameters
value
System.String System.String

The literal value.

typeMapping
RelationalTypeMapping RelationalTypeMapping

An optional type mapping that is used for this value.

Returns
System.String System.String

The generated string.

GenerateLiteralValue(StringBuilder, Boolean) GenerateLiteralValue(StringBuilder, Boolean)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, bool value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Boolean)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Boolean System.Boolean

The literal value.

GenerateLiteralValue(StringBuilder, Byte) GenerateLiteralValue(StringBuilder, Byte)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, byte value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Byte)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Byte System.Byte

The literal value.

GenerateLiteralValue(StringBuilder, Byte[]) GenerateLiteralValue(StringBuilder, Byte())

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, byte[] value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Byte())
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Byte[] System.Byte()

The literal value.

GenerateLiteralValue(StringBuilder, Char) GenerateLiteralValue(StringBuilder, Char)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, char value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Char)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Char System.Char

The literal value.

GenerateLiteralValue(StringBuilder, DateTime) GenerateLiteralValue(StringBuilder, DateTime)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, DateTime value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Date)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.DateTime System.DateTime

The literal value.

GenerateLiteralValue(StringBuilder, DateTimeOffset) GenerateLiteralValue(StringBuilder, DateTimeOffset)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, DateTimeOffset value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As DateTimeOffset)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.DateTimeOffset System.DateTimeOffset

The literal value.

GenerateLiteralValue(StringBuilder, DbType) GenerateLiteralValue(StringBuilder, DbType)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, DbType value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As DbType)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Data.DbType System.Data.DbType

The literal value.

GenerateLiteralValue(StringBuilder, Decimal) GenerateLiteralValue(StringBuilder, Decimal)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, decimal value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Decimal)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Decimal System.Decimal

The literal value.

GenerateLiteralValue(StringBuilder, Double) GenerateLiteralValue(StringBuilder, Double)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, double value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Double)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Double System.Double

The literal value.

GenerateLiteralValue(StringBuilder, Enum) GenerateLiteralValue(StringBuilder, Enum)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, Enum value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As  Enum)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Enum System.Enum

The literal value.

GenerateLiteralValue(StringBuilder, Guid) GenerateLiteralValue(StringBuilder, Guid)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, Guid value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Guid)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Guid System.Guid

The literal value.

GenerateLiteralValue(StringBuilder, Int16) GenerateLiteralValue(StringBuilder, Int16)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, short value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Short)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Int16 System.Int16

The literal value.

GenerateLiteralValue(StringBuilder, Int32) GenerateLiteralValue(StringBuilder, Int32)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, int value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Integer)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Int32 System.Int32

The literal value.

GenerateLiteralValue(StringBuilder, Int64) GenerateLiteralValue(StringBuilder, Int64)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, long value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Long)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Int64 System.Int64

The literal value.

GenerateLiteralValue(StringBuilder, Object) GenerateLiteralValue(StringBuilder, Object)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, object value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Object)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Object System.Object

The literal value.

GenerateLiteralValue(StringBuilder, Single) GenerateLiteralValue(StringBuilder, Single)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, float value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As Single)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.Single System.Single

The literal value.

GenerateLiteralValue(StringBuilder, String, RelationalTypeMapping) GenerateLiteralValue(StringBuilder, String, RelationalTypeMapping)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, string value, RelationalTypeMapping typeMapping)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As String, typeMapping As RelationalTypeMapping)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.String System.String

The literal value.

typeMapping
RelationalTypeMapping RelationalTypeMapping

An optional type mapping that is used for this value.

GenerateLiteralValue(StringBuilder, TimeSpan) GenerateLiteralValue(StringBuilder, TimeSpan)

Writes the SQL representation of a literal value.

protected virtual void GenerateLiteralValue(StringBuilder builder, TimeSpan value)
Protected Overridable Sub GenerateLiteralValue(builder As StringBuilder, value As TimeSpan)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

value
System.TimeSpan System.TimeSpan

The literal value.

GenerateLiteralValue(TimeSpan) GenerateLiteralValue(TimeSpan)

Generates the SQL representation of a literal value.

protected virtual string GenerateLiteralValue(TimeSpan value)
Protected Overridable Function GenerateLiteralValue(value As TimeSpan) As String
Parameters
value
System.TimeSpan System.TimeSpan

The literal value.

Returns
System.String System.String

The generated string.

GenerateParameterName(String) GenerateParameterName(String)

Generates a valid parameter name for the given candidate name.

public virtual string GenerateParameterName(string name)
Public Overridable Function GenerateParameterName(name As String) As String
Parameters
name
System.String System.String

The candidate name for the parameter.

Returns
System.String System.String

A valid name based on the candidate name.

GenerateParameterName(StringBuilder, String) GenerateParameterName(StringBuilder, String)

Writes a valid parameter name for the given candidate name.

public virtual void GenerateParameterName(StringBuilder builder, string name)
Public Overridable Sub GenerateParameterName(builder As StringBuilder, name As String)
Parameters
builder
System.Text.StringBuilder System.Text.StringBuilder

The System.Text.StringBuilder to write generated string to.

name
System.String System.String

The candidate name for the parameter.

GetHashCode() GetHashCode()

Inherited from System.Object

GetType() GetType()

Inherited from System.Object

MemberwiseClone() MemberwiseClone()

Inherited from System.Object

ReferenceEquals(Object, Object) ReferenceEquals(Object, Object)

Inherited from System.Object

ToString() ToString()

Inherited from System.Object