Class SqlCommandExtensions
- Namespace
- FluentCommand
- Assembly
- FluentCommand.SqlServer.dll
Extension methods for IDataCommand specific to SQL Server.
public static class SqlCommandExtensions
- Inheritance
-
SqlCommandExtensions
- Inherited Members
Methods
SqlParameter(IDataCommand, string, DataTable)
Adds a new SQL Server structured table-valued parameter with the specified name
and dataTable
.
public static IDataCommand SqlParameter(this IDataCommand dataCommand, string name, DataTable dataTable)
Parameters
dataCommand
IDataCommandThe IDataCommand to extend.
name
stringThe name of the parameter.
dataTable
DataTableThe DataTable to be added as a table-valued parameter.
Returns
- IDataCommand
The same IDataCommand instance for fluent chaining.
Exceptions
- InvalidOperationException
Thrown if the underlying command is not a SQL Server command.
SqlParameter<TEntity>(IDataCommand, string, IEnumerable<TEntity>)
Adds a new SQL Server structured table-valued parameter with the specified name
and data
.
Converts the enumerable data to a DataTable and adds it as a parameter.
public static IDataCommand SqlParameter<TEntity>(this IDataCommand dataCommand, string name, IEnumerable<TEntity> data) where TEntity : class
Parameters
dataCommand
IDataCommandThe IDataCommand to extend.
name
stringThe name of the parameter.
data
IEnumerable<TEntity>The enumerable data to be added as a table-valued parameter.
Returns
- IDataCommand
The same IDataCommand instance for fluent chaining.
Type Parameters
TEntity
The type of the data entities.