Struct InterpolatedSqlStatement
Represents an SQL statement constructed using interpolated string syntax.
Implements
Inherited Members
Namespace: RentADeveloper.SqlConnectionPlus.SqlStatements
Assembly: RentADeveloper.SqlConnectionPlus.dll
Syntax
public struct InterpolatedSqlStatement : IEquatable<InterpolatedSqlStatement>
Remarks
This type enables passing values as parameters and sequences of values as temporary tables to SQL statements via expressions inside interpolated strings. Therefore, this type implements the C# interpolated string handler pattern (see https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/interpolated-string-handler).
Constructors
| Edit this page View SourceInterpolatedSqlStatement(int, int)
Initializes a new instance of this type.
Declaration
public InterpolatedSqlStatement(int literalLength, int formattedCount)
Parameters
| Type | Name | Description |
|---|---|---|
| int | literalLength | The length of the interpolated string. |
| int | formattedCount | The number of expressions used in the interpolated string. |
Remarks
This constructor is part of the interpolated string handler pattern. It is not intended to be called by user code.
InterpolatedSqlStatement(string?, params (string Name, object? Value)[])
Initializes a new instance of this type.
Declaration
public InterpolatedSqlStatement(string? code, params (string Name, object? Value)[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| string | code | The code of the SQL statement. |
| (string Name, object Value)[] | parameters | The parameters of the SQL statement. |
Remarks
If a parameter value is an Enum, it is serialized according to EnumSerializationMode.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
Methods
| Edit this page View SourceAppendFormatted<T>(T?, int, string?)
Appends the specified value to this instance.
Declaration
public void AppendFormatted<T>(T? value, int alignment = 0, string? format = null)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to append. |
| int | alignment | The minimum number of characters that should be written for |
| string | format | The string to use to format |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value to append. |
Remarks
This method is part of the interpolated string handler pattern. It is not intended to be called by user code.
AppendLiteral(string?)
Appends the specified literal value to this instance.
Declaration
public void AppendLiteral(string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The literal value to append to this instance. |
Remarks
This method is part of the interpolated string handler pattern. It is not intended to be called by user code.
Equals(InterpolatedSqlStatement)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(InterpolatedSqlStatement other)
Parameters
| Type | Name | Description |
|---|---|---|
| InterpolatedSqlStatement | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
Equals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if |
Overrides
| Edit this page View SourceFromString(string)
Creates a new instance of InterpolatedSqlStatement from the specified string.
Declaration
public static InterpolatedSqlStatement FromString(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The string from which to create an instance of InterpolatedSqlStatement. |
Returns
| Type | Description |
|---|---|
| InterpolatedSqlStatement |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
| Edit this page View SourceToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The fully qualified type name. |
Overrides
Operators
| Edit this page View Sourceoperator ==(InterpolatedSqlStatement, InterpolatedSqlStatement)
Determines whether the two specified instances of InterpolatedSqlStatement are equal.
Declaration
public static bool operator ==(InterpolatedSqlStatement left, InterpolatedSqlStatement right)
Parameters
| Type | Name | Description |
|---|---|---|
| InterpolatedSqlStatement | left | The first instance to compare. |
| InterpolatedSqlStatement | right | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the two specified instances of InterpolatedSqlStatement are equal; otherwise, false. |
implicit operator InterpolatedSqlStatement(string)
Implicitly converts a string to an instance of InterpolatedSqlStatement.
Declaration
public static implicit operator InterpolatedSqlStatement(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The string to convert to an instance of InterpolatedSqlStatement. |
Returns
| Type | Description |
|---|---|
| InterpolatedSqlStatement |
operator !=(InterpolatedSqlStatement, InterpolatedSqlStatement)
Determines whether the two specified instances of InterpolatedSqlStatement are unequal.
Declaration
public static bool operator !=(InterpolatedSqlStatement left, InterpolatedSqlStatement right)
Parameters
| Type | Name | Description |
|---|---|---|
| InterpolatedSqlStatement | left | The first instance to compare. |
| InterpolatedSqlStatement | right | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the two the specified instances of InterpolatedSqlStatement are unequal; otherwise, false. |