mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 修复 #454 优化遗留的 bug,影响 Aop.AuditValue 事件;#521
This commit is contained in:
		@@ -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>
 | 
			
		||||
            添加
 | 
			
		||||
@@ -509,14 +502,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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 { }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -374,7 +374,7 @@ namespace FreeSql.Internal.CommonProvider
 | 
			
		||||
                            changedDict.Add(col.Attribute.Name, true);
 | 
			
		||||
                    }
 | 
			
		||||
                    if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
 | 
			
		||||
                        col.SetValue(data, val = "");
 | 
			
		||||
                        col.SetValue(d, val = "");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user