Table of Contents

Class RelationalCommandBuilderExtensions

Namespace
Microsoft.EntityFrameworkCore.Storage
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

Extension methods for the IRelationalCommandBuilder class.

public static class RelationalCommandBuilderExtensions
Inheritance
RelationalCommandBuilderExtensions
Inherited Members

Methods

AddCompositeParameter(IRelationalCommandBuilder, string, IReadOnlyList<IRelationalParameter>)

Adds a parameter that is ultimately represented as multiple DbParameters in the final command.

public static IRelationalCommandBuilder AddCompositeParameter(this IRelationalCommandBuilder commandBuilder, string invariantName, IReadOnlyList<IRelationalParameter> subParameters)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

invariantName string

The key that identifies this parameter. Note that IRelationalParameter just represents a placeholder for a parameter and not the actual value. This is because the same command can be reused multiple times with different parameter values.

subParameters IReadOnlyList<IRelationalParameter>

The parameters to include in the composite.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AddParameter(IRelationalCommandBuilder, string, string)

Adds a parameter.

public static IRelationalCommandBuilder AddParameter(this IRelationalCommandBuilder commandBuilder, string invariantName, string name)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

invariantName string

The key that identifies this parameter. Note that IRelationalParameter just represents a placeholder for a parameter and not the actual value. This is because the same command can be reused multiple times with different parameter values.

name string

The name to be used for the parameter when the command is executed against the database.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AddParameter(IRelationalCommandBuilder, string, string, IProperty)

Adds a parameter.

[Obsolete("Use overload with relationalTypeMapping")]
public static IRelationalCommandBuilder AddParameter(this IRelationalCommandBuilder commandBuilder, string invariantName, string name, IProperty property)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

invariantName string

The key that identifies this parameter. Note that IRelationalParameter just represents a placeholder for a parameter and not the actual value. This is because the same command can be reused multiple times with different parameter values.

name string

The name to be used for the parameter when the command is executed against the database.

property IProperty

The property that the type for this parameter will come from.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AddParameter(IRelationalCommandBuilder, string, string, RelationalTypeMapping, bool)

Adds a parameter.

public static IRelationalCommandBuilder AddParameter(this IRelationalCommandBuilder commandBuilder, string invariantName, string name, RelationalTypeMapping typeMapping, bool nullable)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

invariantName string

The key that identifies this parameter. Note that IRelationalParameter just represents a placeholder for a parameter and not the actual value. This is because the same command can be reused multiple times with different parameter values.

name string

The name to be used for the parameter when the command is executed against the database.

typeMapping RelationalTypeMapping

The type mapping for the property that values for this parameter will come from.

nullable bool

A value indicating whether the parameter can contain null values.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AddParameter(IRelationalCommandBuilder, string, string, RelationalTypeMapping, bool?)

Adds a parameter.

public static IRelationalCommandBuilder AddParameter(this IRelationalCommandBuilder commandBuilder, string invariantName, string name, RelationalTypeMapping relationalTypeMapping, bool? nullable)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

invariantName string

The key that identifies this parameter. Note that IRelationalParameter just represents a placeholder for a parameter and not the actual value. This is because the same command can be reused multiple times with different parameter values.

name string

The name to be used for the parameter when the command is executed against the database.

relationalTypeMapping RelationalTypeMapping

The relational type mapping for this parameter.

nullable bool?

A value indicating whether the parameter could contain a null value.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AddPropertyParameter(IRelationalCommandBuilder, string, string, IProperty)

Adds a parameter.

[Obsolete("Use overload with relationalTypeMapping")]
public static IRelationalCommandBuilder AddPropertyParameter(this IRelationalCommandBuilder commandBuilder, string invariantName, string name, IProperty property)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

invariantName string

The key that identifies this parameter. Note that IRelationalParameter just represents a placeholder for a parameter and not the actual value. This is because the same command can be reused multiple times with different parameter values.

name string

The name to be used for the parameter when the command is executed against the database.

property IProperty

The property that values for this parameter will come from.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AddRawParameter(IRelationalCommandBuilder, string, DbParameter)

Adds a parameter.

public static IRelationalCommandBuilder AddRawParameter(this IRelationalCommandBuilder commandBuilder, string invariantName, DbParameter dbParameter)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

invariantName string

The key that identifies this parameter. Note that IRelationalParameter just represents a placeholder for a parameter and not the actual value. This is because the same command can be reused multiple times with different parameter values.

dbParameter DbParameter

The DbParameter being added.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AppendLine(IRelationalCommandBuilder, string)

Appends an object to the command text on a new line.

public static IRelationalCommandBuilder AppendLine(this IRelationalCommandBuilder commandBuilder, string value)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

value string

The object to be written.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

AppendLines(IRelationalCommandBuilder, string, bool)

Appends an object, that contains multiple lines of text, to the command text. Each line read from the object is appended on a new line.

public static IRelationalCommandBuilder AppendLines(this IRelationalCommandBuilder commandBuilder, string value, bool skipFinalNewline = false)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

value string

The object to be written.

skipFinalNewline bool

If true, then the final newline character is skipped.

Returns

IRelationalCommandBuilder

The same builder instance so that multiple calls can be chained.

Indent(IRelationalCommandBuilder)

Increases the indent of the command text.

public static IDisposable Indent(this IRelationalCommandBuilder commandBuilder)

Parameters

commandBuilder IRelationalCommandBuilder

The command builder.

Returns

IDisposable

The same builder instance so that multiple calls can be chained.