mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 优化 WhereDynamic 支持按字段名、属性名匹配;
This commit is contained in:
parent
c12c552352
commit
efa71e8cba
@ -130,13 +130,6 @@
|
|||||||
清空状态数据
|
清空状态数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</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)">
|
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||||
<summary>
|
<summary>
|
||||||
添加
|
添加
|
||||||
@ -483,7 +476,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="M:FreeSqlDbContextExtensions.NoTracking``1(FreeSql.ISelect{``0})">
|
<member name="M:FreeSqlDbContextExtensions.NoTracking``1(FreeSql.ISelect{``0})">
|
||||||
<summary>
|
<summary>
|
||||||
不跟踪查询的实体数据(在不需要更新其数据时使用),可提长查询性能
|
不跟踪查询的实体数据(在不需要更新其数据时使用),可提升查询性能
|
||||||
</summary>
|
</summary>
|
||||||
<typeparam name="T"></typeparam>
|
<typeparam name="T"></typeparam>
|
||||||
<param name="select"></param>
|
<param name="select"></param>
|
||||||
@ -532,14 +525,5 @@
|
|||||||
<param name="that"></param>
|
<param name="that"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
@ -156,8 +156,8 @@ namespace FreeSql.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class testInsertNullable
|
class testInsertNullable
|
||||||
{
|
{
|
||||||
[Column(IsNullable = false, IsIdentity = true)]
|
[Column(IsNullable = false, IsIdentity = true)]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ namespace FreeSql.Tests
|
|||||||
public int? int1 { get; set; }
|
public int? int1 { get; set; }
|
||||||
[Column(IsNullable = true)]
|
[Column(IsNullable = true)]
|
||||||
public int int2 { get; set; }
|
public int int2 { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class testUpdateNonePk
|
class testUpdateNonePk
|
||||||
{
|
{
|
||||||
@ -177,6 +177,12 @@ namespace FreeSql.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Test03()
|
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>()
|
var sqlextMax112 = g.sqlserver.Select<EdiItem>()
|
||||||
.GroupBy(a => a.Id)
|
.GroupBy(a => a.Id)
|
||||||
.ToSql(a => new
|
.ToSql(a => new
|
||||||
|
@ -333,7 +333,10 @@ namespace FreeSql.Internal
|
|||||||
var psidx = 0;
|
var psidx = 0;
|
||||||
foreach (var p in ps)
|
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 ");
|
if (psidx > 0) sb.Append(" AND ");
|
||||||
sb.Append(aliasAndDot).Append(this.QuoteSqlName(trycol.Attribute.Name));
|
sb.Append(aliasAndDot).Append(this.QuoteSqlName(trycol.Attribute.Name));
|
||||||
sb.Append(this.FormatSql(" = {0}", Utils.GetDataReaderValue(trycol.Attribute.MapType, p.GetValue(dywhere, null))));
|
sb.Append(this.FormatSql(" = {0}", Utils.GetDataReaderValue(trycol.Attribute.MapType, p.GetValue(dywhere, null))));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user