From c67c6dca03d7b818640e172692570cfd00bc53ab Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 25 Aug 2022 00:21:21 +0800 Subject: [PATCH] Add unit test --- Src/Asp.Net/SqlServerTest/UnitTest/UCustom01.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom01.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom01.cs index 6f10d2255..1673b6fae 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom01.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom01.cs @@ -55,6 +55,14 @@ namespace OrmTest var x4 = db.Queryable().Where(it =>SqlFunc.HasValue(it.name) == true).ToList(); var x5 = db.Queryable().Where(it => SqlFunc.HasValue(it.name) ).ToList(); var x6 = db.Queryable().Select(it => new { x=SqlFunc.HasValue(it.name)}).ToList(); + db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings() + { + IsWithNoLockQuery=true + }; + var sql=db.Queryable().LeftJoin((z, y) => z.Id == y.Id).ToSql().Key; + if (!sql.Contains(SqlWith.NoLock)) { throw new Exception("unit error"); } + var sql2=db.SqlQueryable("select * from [Order]").With(SqlWith.Null).LeftJoin((z, y) => z.Id == y.OrderId).ToSql().Key; + if (sql2.Contains(SqlWith.NoLock)) { throw new Exception("unit error"); } db.DbMaintenance.DropTable("BoolTest12313"); }