Class SqlObjectExtensions
Contains various extension methods related to SQL objects.
public static class SqlObjectExtensions
- Inheritance
-
SqlObjectExtensions
- Inherited Members
Methods
CreateDeleteFrom(SqlNewTableNode, Func<SqlNewTableNode, SqlConditionNode>?)
Creates a new SqlDeleteFromNode based on the provided table
and a filter created from its primary key columns and matching parameters.
[Pure]
public static SqlDeleteFromNode CreateDeleteFrom(this SqlNewTableNode table, Func<SqlNewTableNode, SqlConditionNode>? filterExtension = null)
Parameters
tableSqlNewTableNodeTable to create delete from for.
filterExtensionFunc<SqlNewTableNode, SqlConditionNode>Optional delegate which allows to add additional filter to the primary key filter.
Returns
- SqlDeleteFromNode
New SqlDeleteFromNode instance.
Exceptions
- InvalidOperationException
When primary key is not defined or one of its columns is not a valid data field.
CreateDeleteFrom(ISqlTableBuilder, Func<SqlTableBuilderNode, SqlConditionNode>?)
Creates a new SqlDeleteFromNode based on the provided table
and a filter created from its primary key columns and matching parameters.
[Pure]
public static SqlDeleteFromNode CreateDeleteFrom(this ISqlTableBuilder table, Func<SqlTableBuilderNode, SqlConditionNode>? filterExtension = null)
Parameters
tableISqlTableBuilderTable to create delete from for.
filterExtensionFunc<SqlTableBuilderNode, SqlConditionNode>Optional delegate which allows to add additional filter to the primary key filter.
Returns
- SqlDeleteFromNode
New SqlDeleteFromNode instance.
Exceptions
- SqlObjectBuilderException
When primary key builder does not exist.
CreateDeleteFrom(ISqlTable, Func<SqlTableNode, SqlConditionNode>?)
Creates a new SqlDeleteFromNode based on the provided table
and a filter created from its primary key columns and matching parameters.
[Pure]
public static SqlDeleteFromNode CreateDeleteFrom(this ISqlTable table, Func<SqlTableNode, SqlConditionNode>? filterExtension = null)
Parameters
tableISqlTableTable to create delete from for.
filterExtensionFunc<SqlTableNode, SqlConditionNode>Optional delegate which allows to add additional filter to the primary key filter.
Returns
- SqlDeleteFromNode
New SqlDeleteFromNode instance.
CreateInsertInto(SqlNewTableNode, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>?)
Creates a new SqlInsertIntoNode based on the provided table and its columns,
where assigned values are matching parameters.
[Pure]
public static SqlInsertIntoNode CreateInsertInto(this SqlNewTableNode table, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>? valueOverride = null)
Parameters
tableSqlNewTableNodeTable to create insert into for.
valueOverrideFunc<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>Optional delegate which allows to either override the default matching parameter value or skip the column entirely.
Returns
- SqlInsertIntoNode
New SqlInsertIntoNode instance.
Remarks
Computed and identity columns are always skipped.
CreateInsertInto(ISqlTableBuilder, Func<SqlColumnBuilderNode, SqlExpressionOverride>?)
Creates a new SqlInsertIntoNode based on the provided table and its columns,
where assigned values are matching parameters.
[Pure]
public static SqlInsertIntoNode CreateInsertInto(this ISqlTableBuilder table, Func<SqlColumnBuilderNode, SqlExpressionOverride>? valueOverride = null)
Parameters
tableISqlTableBuilderTable to create insert into for.
valueOverrideFunc<SqlColumnBuilderNode, SqlExpressionOverride>Optional delegate which allows to either override the default matching parameter value or skip the column entirely.
Returns
- SqlInsertIntoNode
New SqlInsertIntoNode instance.
Remarks
Computed and identity columns are always skipped.
CreateInsertInto(ISqlTable, Func<SqlColumnNode, SqlExpressionOverride>?)
Creates a new SqlInsertIntoNode based on the provided table and its columns,
where assigned values are matching parameters.
[Pure]
public static SqlInsertIntoNode CreateInsertInto(this ISqlTable table, Func<SqlColumnNode, SqlExpressionOverride>? valueOverride = null)
Parameters
tableISqlTableTable to create insert into for.
valueOverrideFunc<SqlColumnNode, SqlExpressionOverride>Optional delegate which allows to either override the default matching parameter value or skip the column entirely.
Returns
- SqlInsertIntoNode
New SqlInsertIntoNode instance.
Remarks
Computed and identity columns are always skipped.
CreateQuery(SqlNewTableNode, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlSelectionOverride>?, Func<SqlNewTableNode, IEnumerable<SqlSelectNode>>?, Func<SqlNewTableNode, IEnumerable<SqlOrderByNode>>?)
Creates a new SqlDataSourceQueryExpressionNode<TDataSourceNode> based on the provided table,
where by default all columns are selected and ordering is done by primary key.
[Pure]
public static SqlDataSourceQueryExpressionNode<SqlSingleDataSourceNode<SqlNewTableNode>> CreateQuery(this SqlNewTableNode table, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlSelectionOverride>? selectionOverride = null, Func<SqlNewTableNode, IEnumerable<SqlSelectNode>>? additionalSelection = null, Func<SqlNewTableNode, IEnumerable<SqlOrderByNode>>? orderBy = null)
Parameters
tableSqlNewTableNodeTable to create query for.
selectionOverrideFunc<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlSelectionOverride>Optional delegate which allows to either override the default column selection or skip the column entirely.
additionalSelectionFunc<SqlNewTableNode, IEnumerable<SqlSelectNode>>Optional delegate which allows to add custom selection.
orderByFunc<SqlNewTableNode, IEnumerable<SqlOrderByNode>>Optional delegate which allows to override the default ordering by primary key.
Returns
- SqlDataSourceQueryExpressionNode<SqlSingleDataSourceNode<SqlNewTableNode>>
New SqlDataSourceQueryExpressionNode<TDataSourceNode> instance.
CreateQuery(ISqlTableBuilder, Func<SqlColumnBuilderNode, SqlSelectionOverride>?, Func<SqlTableBuilderNode, IEnumerable<SqlSelectNode>>?, Func<SqlTableBuilderNode, IEnumerable<SqlOrderByNode>>?)
Creates a new SqlDataSourceQueryExpressionNode<TDataSourceNode> based on the provided table,
where by default all columns are selected and ordering is done by primary key.
[Pure]
public static SqlDataSourceQueryExpressionNode<SqlSingleDataSourceNode<SqlTableBuilderNode>> CreateQuery(this ISqlTableBuilder table, Func<SqlColumnBuilderNode, SqlSelectionOverride>? selectionOverride = null, Func<SqlTableBuilderNode, IEnumerable<SqlSelectNode>>? additionalSelection = null, Func<SqlTableBuilderNode, IEnumerable<SqlOrderByNode>>? orderBy = null)
Parameters
tableISqlTableBuilderTable to create query for.
selectionOverrideFunc<SqlColumnBuilderNode, SqlSelectionOverride>Optional delegate which allows to either override the default column selection or skip the column entirely.
additionalSelectionFunc<SqlTableBuilderNode, IEnumerable<SqlSelectNode>>Optional delegate which allows to add custom selection.
orderByFunc<SqlTableBuilderNode, IEnumerable<SqlOrderByNode>>Optional delegate which allows to override the default ordering by primary key.
Returns
- SqlDataSourceQueryExpressionNode<SqlSingleDataSourceNode<SqlTableBuilderNode>>
New SqlDataSourceQueryExpressionNode<TDataSourceNode> instance.
CreateQuery(ISqlTable, Func<SqlColumnNode, SqlSelectionOverride>?, Func<SqlTableNode, IEnumerable<SqlSelectNode>>?, Func<SqlTableNode, IEnumerable<SqlOrderByNode>>?)
Creates a new SqlDataSourceQueryExpressionNode<TDataSourceNode> based on the provided table,
where by default all columns are selected and ordering is done by primary key.
[Pure]
public static SqlDataSourceQueryExpressionNode<SqlSingleDataSourceNode<SqlTableNode>> CreateQuery(this ISqlTable table, Func<SqlColumnNode, SqlSelectionOverride>? selectionOverride = null, Func<SqlTableNode, IEnumerable<SqlSelectNode>>? additionalSelection = null, Func<SqlTableNode, IEnumerable<SqlOrderByNode>>? orderBy = null)
Parameters
tableISqlTableTable to create query for.
selectionOverrideFunc<SqlColumnNode, SqlSelectionOverride>Optional delegate which allows to either override the default column selection or skip the column entirely.
additionalSelectionFunc<SqlTableNode, IEnumerable<SqlSelectNode>>Optional delegate which allows to add custom selection.
orderByFunc<SqlTableNode, IEnumerable<SqlOrderByNode>>Optional delegate which allows to override the default ordering by primary key.
Returns
- SqlDataSourceQueryExpressionNode<SqlSingleDataSourceNode<SqlTableNode>>
New SqlDataSourceQueryExpressionNode<TDataSourceNode> instance.
CreateTempTable(ISqlTableBuilder, string, Func<ISqlColumnBuilder, SqlColumnDefinitionOverride>?, bool, Func<ISqlTableBuilder, SqlNewTableNode, SqlCreateTableConstraints>?)
Creates a new SqlCreateTableNode based on the provided table and its columns.
[Pure]
public static SqlCreateTableNode CreateTempTable(this ISqlTableBuilder table, string name, Func<ISqlColumnBuilder, SqlColumnDefinitionOverride>? columnOverride = null, bool ifNotExists = false, Func<ISqlTableBuilder, SqlNewTableNode, SqlCreateTableConstraints>? constraintsProvider = null)
Parameters
tableISqlTableBuilderTable to create temporary table from.
namestringName of the temporary table.
columnOverrideFunc<ISqlColumnBuilder, SqlColumnDefinitionOverride>Optional delegate which allows to either override the default column definition or skip the column entirely.
ifNotExistsboolSpecifies whether the temporary table should only be created if it does not already exist in DB. Equal to false by default.
constraintsProviderFunc<ISqlTableBuilder, SqlNewTableNode, SqlCreateTableConstraints>Optional SqlCreateTableConstraints provider.
Returns
- SqlCreateTableNode
New SqlCreateTableNode instance.
Remarks
Default values, computations and identities are not included in default column definitions.
CreateTempTable(ISqlTable, string, Func<ISqlColumn, SqlColumnDefinitionOverride>?, bool, Func<ISqlTable, SqlNewTableNode, SqlCreateTableConstraints>?)
Creates a new SqlCreateTableNode based on the provided table and its columns.
[Pure]
public static SqlCreateTableNode CreateTempTable(this ISqlTable table, string name, Func<ISqlColumn, SqlColumnDefinitionOverride>? columnOverride = null, bool ifNotExists = false, Func<ISqlTable, SqlNewTableNode, SqlCreateTableConstraints>? constraintsProvider = null)
Parameters
tableISqlTableTable to create temporary table from.
namestringName of the temporary table.
columnOverrideFunc<ISqlColumn, SqlColumnDefinitionOverride>Optional delegate which allows to either override the default column definition or skip the column entirely.
ifNotExistsboolSpecifies whether the temporary table should only be created if it does not already exist in DB. Equal to false by default.
constraintsProviderFunc<ISqlTable, SqlNewTableNode, SqlCreateTableConstraints>Optional SqlCreateTableConstraints provider.
Returns
- SqlCreateTableNode
New SqlCreateTableNode instance.
Remarks
Default values, computations and identities are not included in default column definitions.
CreateUpdate(SqlNewTableNode, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>?, Func<SqlNewTableNode, SqlConditionNode>?)
Creates a new SqlUpdateNode based on the provided table and its columns,
where assigned values are matching parameters, and a filter created from its primary key columns and matching parameters.
[Pure]
public static SqlUpdateNode CreateUpdate(this SqlNewTableNode table, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>? valueOverride = null, Func<SqlNewTableNode, SqlConditionNode>? filterExtension = null)
Parameters
tableSqlNewTableNodeTable to create update for.
valueOverrideFunc<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned matching parameter value or skip the column entirely from being updated.
filterExtensionFunc<SqlNewTableNode, SqlConditionNode>Optional delegate which allows to add additional filter to the primary key filter.
Returns
- SqlUpdateNode
New SqlUpdateNode instance.
Remarks
Computed, identity and primary key columns are always skipped from being updated.
Exceptions
- InvalidOperationException
When primary key is not defined or one of its columns is not a valid data field.
CreateUpdate(ISqlTableBuilder, Func<SqlColumnBuilderNode, SqlExpressionOverride>?, Func<SqlTableBuilderNode, SqlConditionNode>?)
Creates a new SqlUpdateNode based on the provided table and its columns,
where assigned values are matching parameters, and a filter created from its primary key columns and matching parameters.
[Pure]
public static SqlUpdateNode CreateUpdate(this ISqlTableBuilder table, Func<SqlColumnBuilderNode, SqlExpressionOverride>? valueOverride = null, Func<SqlTableBuilderNode, SqlConditionNode>? filterExtension = null)
Parameters
tableISqlTableBuilderTable to create update for.
valueOverrideFunc<SqlColumnBuilderNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned matching parameter value or skip the column entirely from being updated.
filterExtensionFunc<SqlTableBuilderNode, SqlConditionNode>Optional delegate which allows to add additional filter to the primary key filter.
Returns
- SqlUpdateNode
New SqlUpdateNode instance.
Remarks
Computed, identity and primary key columns are always skipped from being updated.
Exceptions
- SqlObjectBuilderException
When primary key builder does not exist.
CreateUpdate(ISqlTable, Func<SqlColumnNode, SqlExpressionOverride>?, Func<SqlTableNode, SqlConditionNode>?)
Creates a new SqlUpdateNode based on the provided table and its columns,
where assigned values are matching parameters, and a filter created from its primary key columns and matching parameters.
[Pure]
public static SqlUpdateNode CreateUpdate(this ISqlTable table, Func<SqlColumnNode, SqlExpressionOverride>? valueOverride = null, Func<SqlTableNode, SqlConditionNode>? filterExtension = null)
Parameters
tableISqlTableTable to create update for.
valueOverrideFunc<SqlColumnNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned matching parameter value or skip the column entirely from being updated.
filterExtensionFunc<SqlTableNode, SqlConditionNode>Optional delegate which allows to add additional filter to the primary key filter.
Returns
- SqlUpdateNode
New SqlUpdateNode instance.
Remarks
Computed, identity and primary key columns are always skipped from being updated.
CreateUpsert(SqlNewTableNode, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>?, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlDataFieldNode, SqlExpressionOverride>?, Func<SqlNewTableNode, SqlInternalRecordSetNode, SqlConditionNode>?)
Creates a new SqlUpsertNode based on the provided table and its columns,
where assigned values are matching parameters.
[Pure]
public static SqlUpsertNode CreateUpsert(this SqlNewTableNode table, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>? insertValueOverride = null, Func<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlDataFieldNode, SqlExpressionOverride>? updateValueOverride = null, Func<SqlNewTableNode, SqlInternalRecordSetNode, SqlConditionNode>? updateFilter = null)
Parameters
tableSqlNewTableNodeTable to create update for.
insertValueOverrideFunc<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned matching parameter value for the insert part or skip the column entirely from being inserted.
updateValueOverrideFunc<SqlColumnDefinitionNode, SqlRawDataFieldNode, SqlDataFieldNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned value for the update part or skip the column entirely from being updated.
updateFilterFunc<SqlNewTableNode, SqlInternalRecordSetNode, SqlConditionNode>Optional delegate which allows to set an additional update filter.
Returns
- SqlUpsertNode
New SqlUpsertNode instance.
Remarks
Computed and identity columns are always skipped from being inserted. Computed, identity and primary key columns are always skipped from being updated.
Exceptions
- InvalidOperationException
When primary key is not defined or one of its columns is not a valid data field.
CreateUpsert(ISqlTableBuilder, Func<SqlColumnBuilderNode, SqlExpressionOverride>?, Func<SqlColumnBuilderNode, SqlDataFieldNode, SqlExpressionOverride>?, Func<SqlTableBuilderNode, SqlInternalRecordSetNode, SqlConditionNode>?)
Creates a new SqlUpsertNode based on the provided table and its columns,
where assigned values are matching parameters.
[Pure]
public static SqlUpsertNode CreateUpsert(this ISqlTableBuilder table, Func<SqlColumnBuilderNode, SqlExpressionOverride>? insertValueOverride = null, Func<SqlColumnBuilderNode, SqlDataFieldNode, SqlExpressionOverride>? updateValueOverride = null, Func<SqlTableBuilderNode, SqlInternalRecordSetNode, SqlConditionNode>? updateFilter = null)
Parameters
tableISqlTableBuilderTable to create update for.
insertValueOverrideFunc<SqlColumnBuilderNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned matching parameter value for the insert part or skip the column entirely from being inserted.
updateValueOverrideFunc<SqlColumnBuilderNode, SqlDataFieldNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned value for the update part or skip the column entirely from being updated.
updateFilterFunc<SqlTableBuilderNode, SqlInternalRecordSetNode, SqlConditionNode>Optional delegate which allows to set an additional update filter.
Returns
- SqlUpsertNode
New SqlUpsertNode instance.
Remarks
Computed and identity columns are always skipped from being inserted. Computed, identity and primary key columns are always skipped from being updated.
Exceptions
- SqlObjectBuilderException
When primary key builder does not exist.
CreateUpsert(ISqlTable, Func<SqlColumnNode, SqlExpressionOverride>?, Func<SqlColumnNode, SqlDataFieldNode, SqlExpressionOverride>?, Func<SqlTableNode, SqlInternalRecordSetNode, SqlConditionNode>?)
Creates a new SqlUpsertNode based on the provided table and its columns,
where assigned values are matching parameters.
[Pure]
public static SqlUpsertNode CreateUpsert(this ISqlTable table, Func<SqlColumnNode, SqlExpressionOverride>? insertValueOverride = null, Func<SqlColumnNode, SqlDataFieldNode, SqlExpressionOverride>? updateValueOverride = null, Func<SqlTableNode, SqlInternalRecordSetNode, SqlConditionNode>? updateFilter = null)
Parameters
tableISqlTableTable to create update for.
insertValueOverrideFunc<SqlColumnNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned matching parameter value for the insert part or skip the column entirely from being inserted.
updateValueOverrideFunc<SqlColumnNode, SqlDataFieldNode, SqlExpressionOverride>Optional delegate which allows to either override the default assigned value for the update part or skip the column entirely from being updated.
updateFilterFunc<SqlTableNode, SqlInternalRecordSetNode, SqlConditionNode>Optional delegate which allows to set an additional update filter.
Returns
- SqlUpsertNode
New SqlUpsertNode instance.
Remarks
Computed and identity columns are always skipped from being inserted. Computed, identity and primary key columns are always skipped from being updated.