- 增加 达梦数据库 ODBC 适配,和单元测试,支持 CodeFirst 模式开发;

This commit is contained in:
28810
2019-12-09 21:25:01 +08:00
parent cc585b4cd5
commit 206d7bdbe0
46 changed files with 10682 additions and 17 deletions

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Xunit;
namespace FreeSql.Tests.Odbc.Dameng
{
public class DamengAopTest
{
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.dameng.Aop.AuditValue += audit;
g.dameng.Insert(item).ExecuteAffrows();
g.dameng.Aop.AuditValue -= audit;
Assert.Equal(item.createtime, date);
}
}
}