Table of Contents

Struct ProcedureParameter

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Describes a single parameter of a raw command or stored procedure: its name, value and the ADO.NET parameter options (ParameterDirection, DbType, Size, TypeName). The same shape serves raw parameterised SQL (ExecuteRaw) and stored procedures (ExecuteProcedure).

public readonly record struct ProcedureParameter : IEquatable<ProcedureParameter>
Implements
Inherited Members
Extension Methods

Constructors

ProcedureParameter(string, object?, ParameterDirection, DbType?, int?, string?)

Describes a single parameter of a raw command or stored procedure: its name, value and the ADO.NET parameter options (ParameterDirection, DbType, Size, TypeName). The same shape serves raw parameterised SQL (ExecuteRaw) and stored procedures (ExecuteProcedure).

public ProcedureParameter(string Name, object? Value, ParameterDirection Direction = ParameterDirection.Input, DbType? DbType = null, int? Size = null, string? TypeName = null)

Parameters

Name string

The parameter name, without the provider's prefix (for example the SQL Server @).

Value object

The value bound to the parameter, or null for a SQL NULL.

Direction ParameterDirection

The parameter direction. Defaults to Input.

DbType DbType?

An explicit provider-independent type, or null to let the provider infer it from Value.

Size int?

The parameter size in bytes/characters, or null for the provider default.

TypeName string

The provider type name of a structured (table-valued) parameter, or null for an ordinary parameter.

Properties

DbType

An explicit provider-independent type, or null to let the provider infer it from Value.

public DbType? DbType { get; init; }

Property Value

DbType?

Direction

The parameter direction. Defaults to Input.

public ParameterDirection Direction { get; init; }

Property Value

ParameterDirection

Name

The parameter name, without the provider's prefix (for example the SQL Server @).

public string Name { get; init; }

Property Value

string

Size

The parameter size in bytes/characters, or null for the provider default.

public int? Size { get; init; }

Property Value

int?

TypeName

The provider type name of a structured (table-valued) parameter, or null for an ordinary parameter.

public string? TypeName { get; init; }

Property Value

string

Value

The value bound to the parameter, or null for a SQL NULL.

public object? Value { get; init; }

Property Value

object

Methods

Table<T>(string, IEnumerable<T>)

Creates an input table-valued parameter from a sequence of rows, for a provider that emulates a table parameter (PostgreSQL and ClickHouse typed arrays; MySQL/MariaDB and SQLite JSON). SQL Server has no emulation — it binds a native user-defined table type — so it requires the typeName argument and must use the overload that takes it. The provider decides how the rows are bound; see each provider's documentation.

public static ProcedureParameter Table<T>(string name, IEnumerable<T> rows)

Parameters

name string

The parameter name, without the provider's prefix.

rows IEnumerable<T>

The rows to bind. An empty sequence binds an empty set.

Returns

ProcedureParameter

An input table-valued parameter descriptor.

Type Parameters

T

The CLR type of each row.

Exceptions

ArgumentException

name is null, empty or whitespace.

ArgumentNullException

rows is null.

Table<T>(string, string, IEnumerable<T>)

Creates an input table-valued parameter for a provider with a named table type (SQL Server user-defined table type); the other providers reject a type name because they emulate the table parameter with a typed array or a JSON document and have no named type to bind.

public static ProcedureParameter Table<T>(string name, string typeName, IEnumerable<T> rows)

Parameters

name string

The parameter name, without the provider's prefix.

typeName string

The user-defined table type name (SQL Server only).

rows IEnumerable<T>

The rows to bind. An empty sequence binds an empty set.

Returns

ProcedureParameter

An input table-valued parameter descriptor.

Type Parameters

T

The CLR type of each row.

Exceptions

ArgumentException

name or typeName is null, empty or whitespace.

ArgumentNullException

rows is null.