- 增加 所有国产数据库支持 CustomMySql、CustomPostgreSQL、CustomOracle、CustomSqlServer 自定义适配;

This commit is contained in:
2881099
2022-09-09 01:38:24 +08:00
parent 3ec8e2118d
commit b7e96620a7
146 changed files with 50828 additions and 29 deletions

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Xunit;
namespace FreeSql.Tests.Custom.Oracle
{
public class OracleAopTest
{
class TestAuditValue
{
public Guid id { get; set; }
[Now]
public DateTime createtime { get; set; }
}
class NowAttribute: Attribute { }
[Fact]
public void AuditValue()
{
var date = DateTime.Now.Date;
var item = new TestAuditValue();
EventHandler<Aop.AuditValueEventArgs> audit = (s, e) =>
{
if (e.Property.GetCustomAttribute<NowAttribute>(false) != null)
e.Value = DateTime.Now.Date;
};
g.oracle.Aop.AuditValue += audit;
g.oracle.Insert(item).ExecuteAffrows();
g.oracle.Aop.AuditValue -= audit;
Assert.Equal(item.createtime, date);
}
}
}