Skip to content

Commit

Permalink
- 增加 UpdateDict/DeleteDict 方法 Where(sql);#1840
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Jun 27, 2024
1 parent d08a937 commit f2e936d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
26 changes: 26 additions & 0 deletions FreeSql/Extensions/FreeSqlGlobalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,19 @@ public UpdateDictImpl WherePrimary(params string[] primarys)
_updateProvider._tempPrimarys = GetPrimarys(_updateProvider._table, primarys);
return this;
}
/// <summary>
/// 原生sql语法条件,Where("col = @xxx", new { xxx = 1 })<para></para>
/// 提示:parms 参数还可以传 Dictionary&lt;string, object&gt;
/// </summary>
/// <param name="sql">sql语法条件</param>
/// <param name="parms">参数</param>
/// <returns></returns>
public UpdateDictImpl Where(string sql, object parms = null)
{
_updateProvider.Where(sql, parms);
return this;
}

public static ColumnInfo[] GetPrimarys(TableInfo table, params string[] primarys)
{
if (primarys?.Any() != true) throw new ArgumentException(nameof(primarys));
Expand Down Expand Up @@ -1321,6 +1334,19 @@ public DeleteDictImpl AsTable(string tableName)
return this;
}

/// <summary>
/// 原生sql语法条件,Where("col = @xxx", new { xxx = 1 })<para></para>
/// 提示:parms 参数还可以传 Dictionary&lt;string, object&gt;
/// </summary>
/// <param name="sql">sql语法条件</param>
/// <param name="parms">参数</param>
/// <returns></returns>
public DeleteDictImpl Where(string sql, object parms = null)
{
_deleteProvider.Where(sql, parms);
return this;
}

public DeleteDictImpl CommandTimeout(int timeout)
{
_deleteProvider.CommandTimeout(timeout);
Expand Down
18 changes: 18 additions & 0 deletions FreeSql/FreeSql.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f2e936d

Please sign in to comment.