- 优化 Aop.AuditValue 审计过的值,IUpdate.UpdateColumns 即使不指定该列也会更新;

This commit is contained in:
28810
2019-10-29 09:55:54 +08:00
parent f7633e9f67
commit 97351a4e6e
6 changed files with 62 additions and 17 deletions

View File

@ -141,6 +141,8 @@ namespace FreeSql.Tests.Sqlite
public bool? testBool1 { get; set; }
public bool? testBool2 { get; set; }
public TestDtoLeftJoin Obj { get; set; }
}
class TestDtoLeftJoin
{
@ -167,7 +169,7 @@ namespace FreeSql.Tests.Sqlite
var testDto3 = select.Limit(10).ToList(a => new TestDto { });
var testDto4 = select.Limit(10).ToList(a => new TestDto() { });
var testDto11 = select.LeftJoin<TestDtoLeftJoin>((a, b) => b.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto { id = a.Id, name = a.Title });
var testDto11 = select.From<TestDtoLeftJoin>((_, b) => _.LeftJoin(a => b.Guid == a.TypeGuid)).Limit(10).ToList((a, b) => new TestDto { id = a.Id, name = a.Title, Obj = b });
var testDto22 = select.LeftJoin<TestDtoLeftJoin>((a, b) => b.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto());
var testDto33 = select.LeftJoin<TestDtoLeftJoin>((a, b) => b.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto { });
var testDto44 = select.LeftJoin<TestDtoLeftJoin>((a, b) => b.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto() { });

View File

@ -408,6 +408,7 @@ namespace FreeSql.Tests
{
public Guid? Id { get; set; }
public string xxx { get; set; }
public string yyy { get; set; }
}
public class TestAddEnum
{
@ -420,6 +421,18 @@ namespace FreeSql.Tests
[Fact]
public void Test1()
{
//g.mysql.Aop.AuditValue += (_, e) =>
//{
// if (e.AuditValueType == FreeSql.Aop.AuditValueType.Update)
// {
// if (e.Property.Name == "xxx")
// e.Value = "xxx";
// }
//};
//var tttee = g.mysql.Select<TestGuidId>().Limit(5).ToList();
//g.mysql.GetGuidRepository<TestGuidId>().UpdateDiy.SetSource(tttee).UpdateColumns(a => new { a.yyy }).NoneParameter().ExecuteAffrows();
//g.mysql.GlobalFilter
// .Apply<TestAddEnum>("test1", a => a.Id == TenrantId.Value)
// .Apply<AuthorTest>("test2", a => a.Id == 111)