Struct InterpolatedSqlStatement
Represents an SQL statement constructed using interpolated string syntax.
Implements
Inherited Members
Namespace: RentADeveloper.DbConnectionPlus.SqlStatements
Assembly: RentADeveloper.DbConnectionPlus.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
View SourceInterpolatedSqlStatement(string, params (string Name, object? Value)[])
Initializes a new instance of the InterpolatedSqlStatement class from the specified SQL code and parameters.
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
View SourceEquals(InterpolatedSqlStatement)
Declaration
public readonly bool Equals(InterpolatedSqlStatement other)
Parameters
| Type | Name | Description |
|---|---|---|
| InterpolatedSqlStatement | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Declaration
public override readonly bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
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 |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
View SourceToString()
Declaration
public override readonly string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
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 |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
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. |