Search Results for

    Show / Hide Table of Contents

    Interface ISelect0<TSelect, T1>

    Namespace: FreeSql
    Assembly: FreeSql.dll
    Syntax
    public interface ISelect0<TSelect, T1> : ISelect0
    Type Parameters
    Name Description
    TSelect
    T1

    Methods

    | Improve this Doc View Source

    Any()

    执行SQL查询,是否有记录

    Declaration
    bool Any()
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    AnyAsync(CancellationToken)

    Declaration
    Task<bool> AnyAsync(CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>
    | Improve this Doc View Source

    AsAlias(Func<Type, String, String>)

    设置别名规则,可用于拦截表别名,实现类似 sqlserver 的 with(nolock) 需求

    如:select.AsAlias((_, old) => $"{old} with(lock)")

    Declaration
    TSelect AsAlias(Func<Type, string, string> aliasRule)
    Parameters
    Type Name Description
    System.Func<System.Type, System.String, System.String> aliasRule
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    AsTable(Func<Type, String, String>)

    设置表名规则,可用于分库/分表,参数1:实体类型;参数2:默认表名;返回值:新表名;

    设置多次,可查询分表后的多个子表记录,以 UNION ALL 形式执行。

    如:select.AsTable((type, oldname) => "table_1").AsTable((type, oldname) => "table_2").AsTable((type, oldname) => "table_3").ToSql(a => a.Id);

    select * from (SELECT a."Id" as1 FROM "table_1" a) ftb

    UNION ALL select * from (SELECT a."Id" as1 FROM "table_2" a) ftb

    UNION ALL select * from (SELECT a."Id" as1 FROM "table_3" a) ftb

    还可以这样:select.AsTable((a, b) => "(select * from tb_topic where clicks > 10)").Page(1, 10).ToList()

    Declaration
    TSelect AsTable(Func<Type, string, string> tableRule)
    Parameters
    Type Name Description
    System.Func<System.Type, System.String, System.String> tableRule
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    AsType(Type)

    动态Type,在使用 Select<object> 后使用本方法,指定实体类型

    Declaration
    TSelect AsType(Type entityType)
    Parameters
    Type Name Description
    System.Type entityType
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Cancel(Func<Boolean>)

    控制取消本次查询

    • 不会产生额外的异常

    • 取消成功,则不执行 SQL 命令

    • 取消成功,直接返回没有记录时候的返回值

    • 取消成功,如 List<T> 返回 0 元素列表,不是 null,仍然是旧机制

    Declaration
    TSelect Cancel(Func<bool> cancel)
    Parameters
    Type Name Description
    System.Func<System.Boolean> cancel

    返回 true,则不会执行 SQL 命令

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    CommandTimeout(Int32)

    命令超时设置(秒)

    Declaration
    TSelect CommandTimeout(int timeout)
    Parameters
    Type Name Description
    System.Int32 timeout
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Count()

    查询的记录数量

    Declaration
    long Count()
    Returns
    Type Description
    System.Int64
    | Improve this Doc View Source

    Count(out Int64)

    查询的记录数量,以参数out形式返回

    Declaration
    TSelect Count(out long count)
    Parameters
    Type Name Description
    System.Int64 count

    返回的变量

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    CountAsync(CancellationToken)

    Declaration
    Task<long> CountAsync(CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Int64>
    | Improve this Doc View Source

    DisableGlobalFilter(String[])

    禁用全局过滤功能,不传参数时将禁用所有

    Declaration
    TSelect DisableGlobalFilter(params string[] name)
    Parameters
    Type Name Description
    System.String[] name

    零个或多个过滤器名字

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Distinct()

    查询数据前,去重

    .Distinct().ToList(x => x.GroupName) 对指定字段去重

    .Distinct().ToList() 对整个查询去重

    Declaration
    TSelect Distinct()
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    First()

    执行SQL查询,返回 T1 实体所有字段的第一条记录,记录不存在时返回 null

    Declaration
    T1 First()
    Returns
    Type Description
    T1
    | Improve this Doc View Source

    FirstAsync(CancellationToken)

    Declaration
    Task<T1> FirstAsync(CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<T1>
    | Improve this Doc View Source

    ForUpdate(Boolean)

    排他更新锁

    注意:务必在开启事务后使用该功能

    MySql: for update

    SqlServer: With(UpdLock, RowLock, NoWait)

    PostgreSQL: for update nowait

    Oracle: for update nowait

    Sqlite: 无效果

    达梦: for update nowait

    人大金仓: for update nowait

    神通: for update

    Declaration
    TSelect ForUpdate(bool nowait = false)
    Parameters
    Type Name Description
    System.Boolean nowait

    noawait

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    GroupBy(String, Object)

    按原生sql语法分组,GroupBy("concat(name, @cc)&quot;, new { cc = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect GroupBy(string sql, object parms = null)
    Parameters
    Type Name Description
    System.String sql

    sql语法

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Having(String, Object)

    按原生sql语法聚合条件过滤,Having("count(name) = @cc&quot;, new { cc = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect Having(string sql, object parms = null)
    Parameters
    Type Name Description
    System.String sql

    sql语法条件

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    InnerJoin(Expression<Func<T1, Boolean>>)

    联接查询,使用导航属性自动生成SQL

    Declaration
    TSelect InnerJoin(Expression<Func<T1, bool>> exp)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<T1, System.Boolean>> exp

    表达式

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    InnerJoin(String, Object)

    联接查询,使用原生sql语法,InnerJoin("type b on b.id = a.id and b.clicks > @clicks&quot;, new { clicks = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect InnerJoin(string sql, object parms = null)
    Parameters
    Type Name Description
    System.String sql

    sql语法条件

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    InnerJoin<T2>(Expression<Func<T1, T2, Boolean>>)

    联接查询,指定关联的实体类型

    Declaration
    TSelect InnerJoin<T2>(Expression<Func<T1, T2, bool>> exp)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<T1, T2, System.Boolean>> exp

    表达式

    Returns
    Type Description
    TSelect
    Type Parameters
    Name Description
    T2

    关联的实体类型

    | Improve this Doc View Source

    LeftJoin(Expression<Func<T1, Boolean>>)

    左联查询,使用导航属性自动生成SQL

    Declaration
    TSelect LeftJoin(Expression<Func<T1, bool>> exp)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<T1, System.Boolean>> exp

    表达式

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    LeftJoin(String, Object)

    左联查询,使用原生sql语法,LeftJoin("type b on b.id = a.id and b.clicks > @clicks&quot;, new { clicks = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect LeftJoin(string sql, object parms = null)
    Parameters
    Type Name Description
    System.String sql

    sql语法条件

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    LeftJoin<T2>(Expression<Func<T1, T2, Boolean>>)

    左联查询,指定关联的实体类型

    Declaration
    TSelect LeftJoin<T2>(Expression<Func<T1, T2, bool>> exp)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<T1, T2, System.Boolean>> exp

    表达式

    Returns
    Type Description
    TSelect
    Type Parameters
    Name Description
    T2

    关联的实体类型

    | Improve this Doc View Source

    Limit(Int32)

    查询多少条数据

    Declaration
    TSelect Limit(int limit)
    Parameters
    Type Name Description
    System.Int32 limit
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Master()

    指定从主库查询(默认查询从库)

    Declaration
    TSelect Master()
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Offset(Int32)

    查询向后偏移行数

    Declaration
    TSelect Offset(int offset)
    Parameters
    Type Name Description
    System.Int32 offset

    行数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    OrderBy(Boolean, String, Object)

    按原生sql语法排序,OrderBy(true, "count(name) + @cc desc", new { cc = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect OrderBy(bool condition, string sql, object parms = null)
    Parameters
    Type Name Description
    System.Boolean condition

    true 时生效

    System.String sql

    sql语法

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    OrderBy(String, Object)

    按原生sql语法排序,OrderBy("count(name) + @cc desc", new { cc = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect OrderBy(string sql, object parms = null)
    Parameters
    Type Name Description
    System.String sql

    sql语法

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    OrderByPropertyName(String, Boolean)

    按属性名字符串排序(支持导航属性)

    属性名:Name

    导航属性:Parent.Name

    多表:b.Name

    Declaration
    TSelect OrderByPropertyName(string property, bool isAscending = true)
    Parameters
    Type Name Description
    System.String property

    属性名:Name

    导航属性:Parent.Name

    多表:b.Name

    System.Boolean isAscending

    顺序 | 倒序

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    OrderByPropertyNameIf(Boolean, String, Boolean)

    按属性名字符串排序(支持导航属性)

    属性名:Name

    导航属性:Parent.Name

    多表:b.Name

    Declaration
    TSelect OrderByPropertyNameIf(bool condition, string property, bool isAscending = true)
    Parameters
    Type Name Description
    System.Boolean condition

    true 时生效

    System.String property

    属性名:Name

    导航属性:Parent.Name

    多表:b.Name

    System.Boolean isAscending

    顺序 | 倒序

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Page(BasePagingInfo)

    分页

    Declaration
    TSelect Page(BasePagingInfo pagingInfo)
    Parameters
    Type Name Description
    BasePagingInfo pagingInfo

    分页信息

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Page(Int32, Int32)

    分页

    Declaration
    TSelect Page(int pageNumber, int pageSize)
    Parameters
    Type Name Description
    System.Int32 pageNumber

    第几页

    System.Int32 pageSize

    每页多少

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    RawJoin(String)

    在 JOIN 位置插入 SQL 内容

    如:.RawJoin("OUTER APPLY ( select id from t2 ) b")

    Declaration
    TSelect RawJoin(string sql)
    Parameters
    Type Name Description
    System.String sql
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    RightJoin(Expression<Func<T1, Boolean>>)

    右联查询,使用导航属性自动生成SQL

    Declaration
    TSelect RightJoin(Expression<Func<T1, bool>> exp)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<T1, System.Boolean>> exp

    表达式

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    RightJoin(String, Object)

    右联查询,使用原生sql语法,RightJoin("type b on b.id = a.id and b.clicks > @clicks&quot;, new { clicks = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect RightJoin(string sql, object parms = null)
    Parameters
    Type Name Description
    System.String sql

    sql语法条件

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    RightJoin<T2>(Expression<Func<T1, T2, Boolean>>)

    右联查询,指定关联的实体类型

    Declaration
    TSelect RightJoin<T2>(Expression<Func<T1, T2, bool>> exp)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<T1, T2, System.Boolean>> exp

    表达式

    Returns
    Type Description
    TSelect
    Type Parameters
    Name Description
    T2

    关联的实体类型

    | Improve this Doc View Source

    Skip(Int32)

    查询向后偏移行数

    Declaration
    TSelect Skip(int offset)
    Parameters
    Type Name Description
    System.Int32 offset
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Take(Int32)

    查询多少条数据

    Declaration
    TSelect Take(int limit)
    Parameters
    Type Name Description
    System.Int32 limit
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    ToChunk(Int32, Action<FetchCallbackArgs<List<T1>>>, Boolean)

    执行SQL查询,分块返回数据,可减少内存开销。比如读取10万条数据,每次返回100条处理。

    Declaration
    void ToChunk(int size, Action<FetchCallbackArgs<List<T1>>> done, bool includeNestedMembers = false)
    Parameters
    Type Name Description
    System.Int32 size

    数据块的大小

    System.Action<FetchCallbackArgs<System.Collections.Generic.List<T1>>> done

    处理数据块

    System.Boolean includeNestedMembers

    false: 返回 2级 LeftJoin/InnerJoin/RightJoin 对象;true: 返回所有 LeftJoin/InnerJoin/RightJoin 的导航数据

    | Improve this Doc View Source

    ToDataTable(String)

    执行SQL查询,返回 DataTable

    Declaration
    DataTable ToDataTable(string field = null)
    Parameters
    Type Name Description
    System.String field
    Returns
    Type Description
    System.Data.DataTable
    | Improve this Doc View Source

    ToDataTableAsync(String, CancellationToken)

    Declaration
    Task<DataTable> ToDataTableAsync(string field = null, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.String field
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Data.DataTable>
    | Improve this Doc View Source

    ToDataTableByPropertyName(String[])

    执行SQL查询,返回 properties 指定的实体类属性,并以 DataTable 接收

    Declaration
    DataTable ToDataTableByPropertyName(string[] properties)
    Parameters
    Type Name Description
    System.String[] properties

    属性名:Name

    导航属性:Parent.Name

    多表:b.Name

    Returns
    Type Description
    System.Data.DataTable
    | Improve this Doc View Source

    ToDataTableByPropertyNameAsync(String[], CancellationToken)

    Declaration
    Task<DataTable> ToDataTableByPropertyNameAsync(string[] properties, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.String[] properties
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Data.DataTable>
    | Improve this Doc View Source

    ToDelete()

    将查询转为删除对象,以便支持导航对象或其他查询功能删除数据,如下:

    fsql.Select<T1>().Where(a => a.Options.xxx == 1).ToDelete().ExecuteAffrows()

    注意:此方法不是将数据查询到内存循环删除,上面的代码产生如下 SQL 执行:

    DELETE FROM T1 WHERE id in (select a.id from T1 a left join Options b on b.t1id = a.id where b.xxx = 1)

    复杂删除使用该方案的好处:

    1、删除前可预览测试数据,防止错误删除操作;

    2、支持更加复杂的删除操作(IDelete 默认只支持简单的操作);

    Declaration
    IDelete<T1> ToDelete()
    Returns
    Type Description
    IDelete<T1>
    | Improve this Doc View Source

    ToDictionary<TKey>(Func<T1, TKey>)

    以字典的形式返回查询结果

    注意:字典的特点会导致返回的数据无序

    Declaration
    Dictionary<TKey, T1> ToDictionary<TKey>(Func<T1, TKey> keySelector)
    Parameters
    Type Name Description
    System.Func<T1, TKey> keySelector
    Returns
    Type Description
    System.Collections.Generic.Dictionary<TKey, T1>
    Type Parameters
    Name Description
    TKey
    | Improve this Doc View Source

    ToDictionary<TKey, TElement>(Func<T1, TKey>, Func<T1, TElement>)

    Declaration
    Dictionary<TKey, TElement> ToDictionary<TKey, TElement>(Func<T1, TKey> keySelector, Func<T1, TElement> elementSelector)
    Parameters
    Type Name Description
    System.Func<T1, TKey> keySelector
    System.Func<T1, TElement> elementSelector
    Returns
    Type Description
    System.Collections.Generic.Dictionary<TKey, TElement>
    Type Parameters
    Name Description
    TKey
    TElement
    | Improve this Doc View Source

    ToDictionaryAsync<TKey>(Func<T1, TKey>, CancellationToken)

    Declaration
    Task<Dictionary<TKey, T1>> ToDictionaryAsync<TKey>(Func<T1, TKey> keySelector, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Func<T1, TKey> keySelector
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey, T1>>
    Type Parameters
    Name Description
    TKey
    | Improve this Doc View Source

    ToDictionaryAsync<TKey, TElement>(Func<T1, TKey>, Func<T1, TElement>, CancellationToken)

    Declaration
    Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TKey, TElement>(Func<T1, TKey> keySelector, Func<T1, TElement> elementSelector, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Func<T1, TKey> keySelector
    System.Func<T1, TElement> elementSelector
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey, TElement>>
    Type Parameters
    Name Description
    TKey
    TElement
    | Improve this Doc View Source

    ToList()

    执行SQL查询,返回 T1 实体所有字段的记录,记录不存在时返回 Count 为 0 的列表

    注意:

    1、ToList(a => a) 可以返回 a 所有实体

    2、ToList(a => new { a }) 这样也可以

    3、ToList((a, b, c) => new { a, b, c }) 这样也可以

    4、abc 怎么来的?请试试 fsql.Select<T1, T2, T3>()

    Declaration
    List<T1> ToList()
    Returns
    Type Description
    System.Collections.Generic.List<T1>
    | Improve this Doc View Source

    ToList(Boolean)

    执行SQL查询,返回 T1 实体、以及 LeftJoin/InnerJoin/RightJoin 对象

    Declaration
    List<T1> ToList(bool includeNestedMembers)
    Parameters
    Type Name Description
    System.Boolean includeNestedMembers

    false: 返回 2级 LeftJoin/InnerJoin/RightJoin 对象;true: 返回所有 LeftJoin/InnerJoin/RightJoin 的导航数据

    Returns
    Type Description
    System.Collections.Generic.List<T1>
    | Improve this Doc View Source

    ToList<TTuple>(String)

    执行SQL查询,返回 field 指定字段的记录,并以元组或基础类型(int,string,long)接收,记录不存在时返回 Count 为 0 的列表

    Declaration
    List<TTuple> ToList<TTuple>(string field)
    Parameters
    Type Name Description
    System.String field
    Returns
    Type Description
    System.Collections.Generic.List<TTuple>
    Type Parameters
    Name Description
    TTuple
    | Improve this Doc View Source

    ToListAsync(Boolean, CancellationToken)

    Declaration
    Task<List<T1>> ToListAsync(bool includeNestedMembers, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Boolean includeNestedMembers
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<T1>>
    | Improve this Doc View Source

    ToListAsync(CancellationToken)

    Declaration
    Task<List<T1>> ToListAsync(CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<T1>>
    | Improve this Doc View Source

    ToListAsync<TTuple>(String, CancellationToken)

    Declaration
    Task<List<TTuple>> ToListAsync<TTuple>(string field, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.String field
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<TTuple>>
    Type Parameters
    Name Description
    TTuple
    | Improve this Doc View Source

    ToOne()

    执行SQL查询,返回 T1 实体所有字段的第一条记录,记录不存在时返回 null

    Declaration
    T1 ToOne()
    Returns
    Type Description
    T1
    | Improve this Doc View Source

    ToOneAsync(CancellationToken)

    Declaration
    Task<T1> ToOneAsync(CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task<T1>
    | Improve this Doc View Source

    ToSql(String)

    返回即将执行的SQL语句

    Declaration
    string ToSql(string field = null)
    Parameters
    Type Name Description
    System.String field

    指定字段

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    ToUpdate()

    将查询转为更新对象,以便支持导航对象或其他查询功能更新数据,如下:

    fsql.Select<T1>().Where(a => a.Options.xxx == 1).ToUpdate().Set(a => a.Title, "111").ExecuteAffrows()

    注意:此方法不是将数据查询到内存循环更新,上面的代码产生如下 SQL 执行:

    UPDATE T1 SET Title = '111' WHERE id in (select a.id from T1 a left join Options b on b.t1id = a.id where b.xxx = 1)

    复杂更新使用该方案的好处:

    1、更新前可预览测试数据,防止错误更新操作;

    2、支持更加复杂的更新操作(IUpdate 默认只支持简单的操作);

    Declaration
    IUpdate<T1> ToUpdate()
    Returns
    Type Description
    IUpdate<T1>
    | Improve this Doc View Source

    TrackToList(Action<Object>)

    审核或跟踪 ToList 即将返回的数据

    Declaration
    TSelect TrackToList(Action<object> action)
    Parameters
    Type Name Description
    System.Action<System.Object> action
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    Where(String, Object)

    原生sql语法条件,Where("id = @id&quot;, new { id = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect Where(string sql, object parms = null)
    Parameters
    Type Name Description
    System.String sql

    sql语法条件

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    WhereDynamicFilter(DynamicFilterInfo)

    动态过滤条件

    Declaration
    TSelect WhereDynamicFilter(DynamicFilterInfo filter)
    Parameters
    Type Name Description
    DynamicFilterInfo filter
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    WhereIf(Boolean, String, Object)

    原生sql语法条件,WhereIf(true, "id = @id&quot;, new { id = 1 })

    提示:parms 参数还可以传 Dictionary<string, object>

    Declaration
    TSelect WhereIf(bool condition, string sql, object parms = null)
    Parameters
    Type Name Description
    System.Boolean condition

    true 时生效

    System.String sql

    sql语法条件

    System.Object parms

    参数

    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    WithConnection(DbConnection)

    指定连接对象

    Declaration
    TSelect WithConnection(DbConnection connection)
    Parameters
    Type Name Description
    System.Data.Common.DbConnection connection
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    WithParameters(List<DbParameter>)

    使用自定义参数化,UnionALL 或者 ToSql 可能有需要

    Declaration
    TSelect WithParameters(List<DbParameter> parameters)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Data.Common.DbParameter> parameters
    Returns
    Type Description
    TSelect
    | Improve this Doc View Source

    WithTransaction(DbTransaction)

    指定事务对象

    Declaration
    TSelect WithTransaction(DbTransaction transaction)
    Parameters
    Type Name Description
    System.Data.Common.DbTransaction transaction
    Returns
    Type Description
    TSelect
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX