From b3316309544afbb19d5efcd85766ea3134fc3aa6 Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Fri, 1 Nov 2019 18:49:13 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20FreeSql.DbContext=20?= =?UTF-8?q?=E6=9E=90=E6=9E=84=E6=96=B9=E6=B3=95=E7=9A=84=20bug=EF=BC=8C?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E5=9B=9E=E6=BB=9A=E4=BA=86=E5=A4=96?= =?UTF-8?q?=E9=83=A8=20UnitOfWork=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql.DbContext/DbContext/DbContext.cs | 5 +++-- .../PostgreSQL/PostgreSQLExpression/TimeSpanTest.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FreeSql.DbContext/DbContext/DbContext.cs b/FreeSql.DbContext/DbContext/DbContext.cs index ba543262..449a6f32 100644 --- a/FreeSql.DbContext/DbContext/DbContext.cs +++ b/FreeSql.DbContext/DbContext/DbContext.cs @@ -13,7 +13,7 @@ namespace FreeSql public IFreeSql Orm => _ormPriv ?? throw new ArgumentNullException("请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql"); #region Property UnitOfWork - internal bool _isUseUnitOfWork = true; //是否使用工作单元事务 + internal bool _isUseUnitOfWork = true; //是否创建工作单元事务 IUnitOfWork _uowPriv; public IUnitOfWork UnitOfWork { @@ -220,7 +220,8 @@ namespace FreeSql _dicSet.Clear(); AllSets.Clear(); - UnitOfWork?.Rollback(); + if (_isUseUnitOfWork) + UnitOfWork?.Rollback(); } finally { diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/PostgreSQL/PostgreSQLExpression/TimeSpanTest.cs b/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/PostgreSQL/PostgreSQLExpression/TimeSpanTest.cs index 6613f1d8..81ebea29 100644 --- a/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/PostgreSQL/PostgreSQLExpression/TimeSpanTest.cs +++ b/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/PostgreSQL/PostgreSQLExpression/TimeSpanTest.cs @@ -284,7 +284,7 @@ namespace FreeSql.Tests.Odbc.PostgreSQLExpression public void TimeSpan_Parse() { var data = new List(); - data.Add(select.Where(a => TimeSpan.Parse(a.CreateTime.TimeOfDay.ToString()) > TimeSpan.Zero).ToList()); + //data.Add(select.Where(a => TimeSpan.Parse(a.CreateTime.TimeOfDay.ToString()) > TimeSpan.Zero).ToList()); //SELECT a.`Id` as1, a.`Clicks` as2, a.`TypeGuid` as3, a.`Title` as4, a.`CreateTime` as5 //FROM `tb_topic` a //WHERE (cast(date_format(date_add(cast('0001/1/1 0:00:00' as datetime), interval (timestampdiff(microsecond, date_format(a.`CreateTime`, '1970-1-1 %H:%i:%s.%f'), a.`CreateTime`) + 62135596800000000)) microsecond), '%Y-%m-%d %H:%i:%s.%f') as signed) > 0)