mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 修复 2.0.103 Uow.Orm 事务 bug;
This commit is contained in:
@ -499,6 +499,35 @@ namespace FreeSql.Tests
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OrmScoped()
|
||||
{
|
||||
var fsql = g.sqlserver;
|
||||
//fsql.Aop.CommandBefore += (s, e) =>
|
||||
//{
|
||||
// Console.WriteLine(e.Command.CommandText);
|
||||
//};
|
||||
|
||||
var repo = fsql.GetRepository<ts_repo_update_bit>();
|
||||
repo.Orm.Ado.ExecuteNonQuery("select 1");
|
||||
|
||||
using (var ctx = fsql.CreateDbContext())
|
||||
{
|
||||
ctx.Orm.Ado.ExecuteNonQuery("select 1");
|
||||
}
|
||||
|
||||
using (var uow = fsql.CreateUnitOfWork())
|
||||
{
|
||||
uow.Orm.Ado.ExecuteNonQuery("select 1");
|
||||
}
|
||||
|
||||
using (var uow = fsql.CreateUnitOfWork())
|
||||
{
|
||||
repo.UnitOfWork = uow;
|
||||
repo.Orm.Ado.ExecuteNonQuery("select 1");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UpdateBit()
|
||||
{
|
||||
|
Reference in New Issue
Block a user