Interface ICommandGenerator<T>
Iterface, which describes generating single-table commands that are used to commit changes made to a DbSet with the associated database.
Namespace: Kros.KORM.CommandGenerator
Assembly: Kros.KORM.dll
Syntax
public interface ICommandGenerator<T>
Type Parameters
Name | Description |
---|---|
T |
Methods
FillCommand(DbCommand, T, ValueGenerated)
Fills command's parameters with values from item
.
Declaration
void FillCommand(DbCommand command, T item, ValueGenerated valueGenerated)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbCommand | command | Command which parameters are filled. |
T | item | Item, from which command is filled. |
ValueGenerated | valueGenerated | Indicates when a value for a property will be generated by the database. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Either |
GetColumnValue(ColumnInfo, T, ValueGenerated)
Gets value from the specific column.
Declaration
object GetColumnValue(ColumnInfo columnInfo, T item, ValueGenerated valueGenerated)
Parameters
Type | Name | Description |
---|---|---|
ColumnInfo | columnInfo | The specific column. |
T | item | The item whose value will be returned. |
ValueGenerated | valueGenerated | Indicates when a value for a property will be generated by the database. |
Returns
Type | Description |
---|---|
System.Object | Value from the specific column. |
GetDeleteCommand()
Gets the automatically generated DbCommand object required to perform deletions on the database.
Declaration
DbCommand GetDeleteCommand()
Returns
Type | Description |
---|---|
System.Data.Common.DbCommand | Delete command. |
Exceptions
Type | Condition |
---|---|
MissingPrimaryKeyException | GetDeleteCommand doesn't supported when entity doesn't have primary key. |
GetDeleteCommand(WhereExpression)
Get delete command with specific condition.
Declaration
DbCommand GetDeleteCommand(WhereExpression whereExpression)
Parameters
Type | Name | Description |
---|---|---|
WhereExpression | whereExpression | Where condition for DELETE statement. |
Returns
Type | Description |
---|---|
System.Data.Common.DbCommand | Delete command. |
GetDeleteCommands(IEnumerable)
Gets the automatically generated DbCommands object required to perform deletions on the database.
Declaration
IEnumerable<DbCommand> GetDeleteCommands(IEnumerable ids)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | ids | Items ids to delete. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Data.Common.DbCommand> | Delete command collection. |
Exceptions
Type | Condition |
---|---|
MissingPrimaryKeyException |
|
CompositePrimaryKeyException | Table has composite primary key. |
GetInsertCommand()
Gets the automatically generated DbCommand object required to perform insertions on the database.
Declaration
DbCommand GetInsertCommand()
Returns
Type | Description |
---|---|
System.Data.Common.DbCommand | Insert command. |
GetQueryColumns(ValueGenerated)
Get columns for query.
Declaration
IEnumerable<ColumnInfo> GetQueryColumns(ValueGenerated valueGenerated)
Parameters
Type | Name | Description |
---|---|---|
ValueGenerated | valueGenerated | Indicates when a value for a property will be generated byt the database. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ColumnInfo> |
GetUpdateCommand()
Gets the automatically generated DbCommand object required to perform updates on the database
Declaration
DbCommand GetUpdateCommand()
Returns
Type | Description |
---|---|
System.Data.Common.DbCommand | Update command. |
Exceptions
Type | Condition |
---|---|
MissingPrimaryKeyException | GetUpdateCommand doesn't supported when entity doesn't have primary key. |