Class DbConnectionByInstanceExtension
Inheritance
Inherited Members
Namespace: Mellivora
Assembly: cs.temp.dll.dll
Syntax
public static class DbConnectionByInstanceExtension
Methods
ExecuteNonQueryByInstance<T>(IDbConnection, String, T)
通过ExecuteNonQuery方式来操作数据
Declaration
public static int ExecuteNonQueryByInstance<T>(this IDbConnection connection, string commandText, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| T | value | 映射到SQL语句的实例 |
Returns
| Type | Description |
|---|---|
| System.Int32 | 返回影响的行数 |
Type Parameters
| Name | Description |
|---|---|
| T | 实例数据类型 |
ExecuteNonQueryByInstances<T>(IDbConnection, String, T[])
通过ExecuteNonQuery方式来操作数据
Declaration
public static List<T> ExecuteNonQueryByInstances<T>(this IDbConnection connection, string commandText, T[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| T[] | values | 映射到SQL语句的实例数组 |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<T> | 返回操作失误的实例数据集合 |
Type Parameters
| Name | Description |
|---|---|
| T | 实例数据类型 |
ExecuteScalarByInstance<T>(IDbConnection, String, T)
通过ExecuteScalar方式来操作数据
Declaration
public static object ExecuteScalarByInstance<T>(this IDbConnection connection, string commandText, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| T | value |
Returns
| Type | Description |
|---|---|
| System.Object | 返回结果 |
Type Parameters
| Name | Description |
|---|---|
| T | 实例数据类型 |
ExecuteScalarByInstance<R, T>(IDbConnection, String, T)
通过ExecuteScalar方式来操作数据
Declaration
public static R ExecuteScalarByInstance<R, T>(this IDbConnection connection, string commandText, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| T | value |
Returns
| Type | Description |
|---|---|
| R | 返回结果 |
Type Parameters
| Name | Description |
|---|---|
| R | 结果的类型 |
| T | 实例数据类型 |
ExecuteScalarByInstances<T>(IDbConnection, String, T[])
通过ExecuteScalar方式来操作数据
Declaration
public static List<object> ExecuteScalarByInstances<T>(this IDbConnection connection, string commandText, T[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| T[] | values | 映射到SQL语句的实例数组 |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Object> | 返回结果集 |
Type Parameters
| Name | Description |
|---|---|
| T | 实例数据类型 |
ExecuteScalarByInstances<R, T>(IDbConnection, String, T[])
通过ExecuteScalar方式来操作数据
Declaration
public static List<R> ExecuteScalarByInstances<R, T>(this IDbConnection connection, string commandText, T[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| T[] | values | 映射到SQL语句的实例数组 |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<R> | 返回结果集 |
Type Parameters
| Name | Description |
|---|---|
| R | 结果的类型 |
| T | 实例数据类型 |
QueryByInstance<T>(IDbConnection, String, Object)
通过实例,查询数据
Declaration
public static IEnumerable<T> QueryByInstance<T>(this IDbConnection connection, string commandText, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| System.Object | value | 映射到SQL语句的实例 |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T> | T类型数据集合 |
Type Parameters
| Name | Description |
|---|---|
| T | 需要返回数据类型 |
QueryByInstance<T>(IDbConnection, String, Object, Int32, Int32)
通过实例以及reader的起始位置、长度来查询满足条件的数据
Declaration
public static IEnumerable<T> QueryByInstance<T>(this IDbConnection connection, string commandText, object value, int startField, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| System.Object | value | 映射到SQL语句的实例 |
| System.Int32 | startField | reader起始列 |
| System.Int32 | length | 从起始列继续向后查询列的个数 |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T> | T类型数据集合 |
Type Parameters
| Name | Description |
|---|---|
| T | 需要返回数据类型 |
QueryByInstances<T>(IDbConnection, String, Object[])
通过多个实例查询满足条件的数据
Declaration
public static IEnumerable<T> QueryByInstances<T>(this IDbConnection connection, string commandText, object[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| System.Object[] | values | 映射到SQL语句的实例数组 |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T> | T类型集合 |
Type Parameters
| Name | Description |
|---|---|
| T | 需要返回数据的类型 |
QueryByInstances<T>(IDbConnection, String, Object[], Int32, Int32)
通过多个实例以及reader的起始位置、长度来查询满足条件的数据
Declaration
public static IEnumerable<T> QueryByInstances<T>(this IDbConnection connection, string commandText, object[] values, int startField, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| System.Object[] | values | 映射到SQL语句的实例数组 |
| System.Int32 | startField | reader起始列 |
| System.Int32 | length | 从起始列继续向后查询列的个数 |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T> | T类型数据集合 |
Type Parameters
| Name | Description |
|---|---|
| T | 需要返回数据类型 |
SingleByInstance<T>(IDbConnection, String, Object)
通过实例,查询一条数据
Declaration
public static T SingleByInstance<T>(this IDbConnection connection, string commandText, object value)where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| System.Object | value | 映射到SQL语句的实例 |
Returns
| Type | Description |
|---|---|
| T | T类型数据 |
Type Parameters
| Name | Description |
|---|---|
| T | 需要返回数据类型 |
SingleByInstance<T>(IDbConnection, String, Object, Int32, Int32)
通过实例以及reader的起始位置、长度查询一条数据
Declaration
public static T SingleByInstance<T>(this IDbConnection connection, string commandText, object value, int startField, int length)where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | 对IDbConnection扩展 |
| System.String | commandText | SQL语句 |
| System.Object | value | 映射到SQL语句的实例 |
| System.Int32 | startField | reader起始列 |
| System.Int32 | length | 从起始列继续向后查询列的个数 |
Returns
| Type | Description |
|---|---|
| T | T类型数据 |
Type Parameters
| Name | Description |
|---|---|
| T | 需要返回数据类型 |