- 修复 #454 优化遗留的 bug,影响 Aop.AuditValue 事件;#521

This commit is contained in:
2881099
2020-11-06 08:42:56 +08:00
parent 5ad30ccb91
commit a73e882f4e
3 changed files with 16 additions and 17 deletions

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Reflection;
using System.Text;
using System.Threading;
using Xunit;
@ -17,6 +18,18 @@ namespace FreeSql.Tests.Issues
public void SelectTest()
{
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.Insert(new ts521 { ID = 1000000000000000001 }).ExecuteAffrows();
@ -28,6 +41,7 @@ namespace FreeSql.Tests.Issues
class ts521
{
[Key]
[Snowflake]
public long ID { get; set; }
[Description("名字")]
@ -44,5 +58,6 @@ namespace FreeSql.Tests.Issues
[Column(IsVersion = true, InsertValueSql = "1")]
public long Version { get; set; }
}
public class SnowflakeAttribute: Attribute { }
}
}