Struct SqlCreateTableConstraints
- Namespace
- LfrlAnvil.Sql.Expressions
- Assembly
- LfrlAnvil.Sql.Core.dll
Represents a collection of constraints for an SqlCreateTableNode.
public readonly record struct SqlCreateTableConstraints : IEquatable<SqlCreateTableConstraints>
- Implements
- Inherited Members
Constructors
SqlCreateTableConstraints(SqlPrimaryKeyDefinitionNode?, ReadOnlyArray<SqlForeignKeyDefinitionNode>?, ReadOnlyArray<SqlCheckDefinitionNode>?)
Represents a collection of constraints for an SqlCreateTableNode.
public SqlCreateTableConstraints(SqlPrimaryKeyDefinitionNode? PrimaryKey, ReadOnlyArray<SqlForeignKeyDefinitionNode>? ForeignKeys, ReadOnlyArray<SqlCheckDefinitionNode>? Checks)
Parameters
PrimaryKey
SqlPrimaryKeyDefinitionNodePrimary key constraint.
ForeignKeys
ReadOnlyArray<SqlForeignKeyDefinitionNode>?Collection of foreign key constraints.
Checks
ReadOnlyArray<SqlCheckDefinitionNode>?Collection of check constraints.
Fields
Empty
Represents an empty collection of constraints.
public static readonly SqlCreateTableConstraints Empty
Field Value
Properties
Checks
Collection of check constraints.
public ReadOnlyArray<SqlCheckDefinitionNode>? Checks { get; init; }
Property Value
ForeignKeys
Collection of foreign key constraints.
public ReadOnlyArray<SqlForeignKeyDefinitionNode>? ForeignKeys { get; init; }
Property Value
PrimaryKey
Primary key constraint.
public SqlPrimaryKeyDefinitionNode? PrimaryKey { get; init; }
Property Value
Methods
WithChecks(params SqlCheckDefinitionNode[])
Creates a new SqlCreateTableConstraints instance with changed Checks.
[Pure]
public SqlCreateTableConstraints WithChecks(params SqlCheckDefinitionNode[] nodes)
Parameters
nodes
SqlCheckDefinitionNode[]Collection of checks to set.
Returns
- SqlCreateTableConstraints
New SqlCreateTableConstraints instance.
WithForeignKeys(params SqlForeignKeyDefinitionNode[])
Creates a new SqlCreateTableConstraints instance with changed ForeignKeys.
[Pure]
public SqlCreateTableConstraints WithForeignKeys(params SqlForeignKeyDefinitionNode[] nodes)
Parameters
nodes
SqlForeignKeyDefinitionNode[]Collection of foreign keys to set.
Returns
- SqlCreateTableConstraints
New SqlCreateTableConstraints instance.
WithPrimaryKey(SqlPrimaryKeyDefinitionNode?)
Creates a new SqlCreateTableConstraints instance with changed PrimaryKey.
[Pure]
public SqlCreateTableConstraints WithPrimaryKey(SqlPrimaryKeyDefinitionNode? node)
Parameters
node
SqlPrimaryKeyDefinitionNodePrimary key to set.
Returns
- SqlCreateTableConstraints
New SqlCreateTableConstraints instance.