mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 修复 #454 优化遗留的 bug,影响 Aop.AuditValue 事件;#521
This commit is contained in:
parent
5ad30ccb91
commit
a73e882f4e
@ -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>
|
||||||
添加
|
添加
|
||||||
@ -509,14 +502,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>
|
||||||
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@ -17,6 +18,18 @@ namespace FreeSql.Tests.Issues
|
|||||||
public void SelectTest()
|
public void SelectTest()
|
||||||
{
|
{
|
||||||
IFreeSql fsql = g.sqlserver;
|
IFreeSql fsql = g.sqlserver;
|
||||||
|
|
||||||
|
//fsql.Aop.AuditValue += (s, e) => {
|
||||||
|
// if (e.Column.CsType == typeof(long)
|
||||||
|
// && e.Property.GetCustomAttribute<SnowflakeAttribute>(false) != null
|
||||||
|
// && e.Value?.ToString() == "0")
|
||||||
|
// {
|
||||||
|
// e.Value = 1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
fsql.Delete<ts521>().Where("1=1").ExecuteAffrows();
|
fsql.Delete<ts521>().Where("1=1").ExecuteAffrows();
|
||||||
fsql.Insert(new ts521 { ID = 1000000000000000001 }).ExecuteAffrows();
|
fsql.Insert(new ts521 { ID = 1000000000000000001 }).ExecuteAffrows();
|
||||||
|
|
||||||
@ -28,6 +41,7 @@ namespace FreeSql.Tests.Issues
|
|||||||
class ts521
|
class ts521
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
[Snowflake]
|
||||||
public long ID { get; set; }
|
public long ID { get; set; }
|
||||||
|
|
||||||
[Description("名字")]
|
[Description("名字")]
|
||||||
@ -44,5 +58,6 @@ namespace FreeSql.Tests.Issues
|
|||||||
[Column(IsVersion = true, InsertValueSql = "1")]
|
[Column(IsVersion = true, InsertValueSql = "1")]
|
||||||
public long Version { get; set; }
|
public long Version { get; set; }
|
||||||
}
|
}
|
||||||
|
public class SnowflakeAttribute: Attribute { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
changedDict.Add(col.Attribute.Name, true);
|
changedDict.Add(col.Attribute.Name, true);
|
||||||
}
|
}
|
||||||
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
|
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
|
||||||
col.SetValue(data, val = "");
|
col.SetValue(d, val = "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user