mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 优化 WhereDynamic 支持按字段名、属性名匹配;
This commit is contained in:
parent
c12c552352
commit
efa71e8cba
@ -130,13 +130,6 @@
|
||||
清空状态数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
||||
<summary>
|
||||
根据 lambda 条件删除数据
|
||||
</summary>
|
||||
<param name="predicate"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||
<summary>
|
||||
添加
|
||||
@ -483,7 +476,7 @@
|
||||
</member>
|
||||
<member name="M:FreeSqlDbContextExtensions.NoTracking``1(FreeSql.ISelect{``0})">
|
||||
<summary>
|
||||
不跟踪查询的实体数据(在不需要更新其数据时使用),可提长查询性能
|
||||
不跟踪查询的实体数据(在不需要更新其数据时使用),可提升查询性能
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="select"></param>
|
||||
@ -532,14 +525,5 @@
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
||||
<summary>
|
||||
批量注入 Repository,可以参考代码自行调整
|
||||
</summary>
|
||||
<param name="services"></param>
|
||||
<param name="globalDataFilter"></param>
|
||||
<param name="assemblies"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
@ -156,18 +156,18 @@ namespace FreeSql.Tests
|
||||
}
|
||||
}
|
||||
|
||||
class testInsertNullable
|
||||
{
|
||||
[Column(IsNullable = false, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
class testInsertNullable
|
||||
{
|
||||
[Column(IsNullable = false, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Column(IsNullable = false)]
|
||||
public string str1 { get; set; }
|
||||
[Column(IsNullable = false)]
|
||||
public int? int1 { get; set; }
|
||||
[Column(IsNullable = true)]
|
||||
public int int2 { get; set; }
|
||||
}
|
||||
[Column(IsNullable = false)]
|
||||
public string str1 { get; set; }
|
||||
[Column(IsNullable = false)]
|
||||
public int? int1 { get; set; }
|
||||
[Column(IsNullable = true)]
|
||||
public int int2 { get; set; }
|
||||
}
|
||||
|
||||
class testUpdateNonePk
|
||||
{
|
||||
@ -177,6 +177,12 @@ namespace FreeSql.Tests
|
||||
[Fact]
|
||||
public void Test03()
|
||||
{
|
||||
var updateSql = g.sqlite.Update<object>()
|
||||
.AsType(typeof(testInsertNullable))
|
||||
.SetDto(new { str1 = "xxx" })
|
||||
.WhereDynamic(1)
|
||||
.ToSql();
|
||||
|
||||
var sqlextMax112 = g.sqlserver.Select<EdiItem>()
|
||||
.GroupBy(a => a.Id)
|
||||
.ToSql(a => new
|
||||
|
@ -333,7 +333,10 @@ namespace FreeSql.Internal
|
||||
var psidx = 0;
|
||||
foreach (var p in ps)
|
||||
{
|
||||
if (table.Columns.TryGetValue(p.Name, out var trycol) == false) continue;
|
||||
table.Columns.TryGetValue(p.Name, out var trycol);
|
||||
if (trycol == null) table.ColumnsByCs.TryGetValue(p.Name, out trycol);
|
||||
if (trycol == null) continue;
|
||||
|
||||
if (psidx > 0) sb.Append(" AND ");
|
||||
sb.Append(aliasAndDot).Append(this.QuoteSqlName(trycol.Attribute.Name));
|
||||
sb.Append(this.FormatSql(" = {0}", Utils.GetDataReaderValue(trycol.Attribute.MapType, p.GetValue(dywhere, null))));
|
||||
|
Loading…
x
Reference in New Issue
Block a user