diff --git a/Src/Asp.Net/SqlServerTest/BugTest/Bug2.cs b/Src/Asp.Net/SqlServerTest/BugTest/Bug2.cs new file mode 100644 index 000000000..00df2a071 --- /dev/null +++ b/Src/Asp.Net/SqlServerTest/BugTest/Bug2.cs @@ -0,0 +1,36 @@ +using OrmTest.Models; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OrmTest.BugTest +{ + public class Bug2 + { + public SqlSugarClient DB + { + get { + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + InitKeyType = InitKeyType.Attribute, + ConnectionString = Config.ConnectionString, + DbType = DbType.SqlServer, + IsAutoCloseConnection = true + }); + return db; + } + } + public void Init() { + var x2= DB.Queryable().Where(x => x.Id == SqlFunc.Subqueryable().Where(y => y.Id == SqlFunc.Subqueryable().Where(yy => y.Id == x.Id).Select(yy => yy.Id)).Select(y => y.Id)).ToSql(); + if (!x2.Key.Contains("STudent")) { + throw new Exception("bug2 error"); + } + } + } + + + + +} \ No newline at end of file diff --git a/Src/Asp.Net/SqlServerTest/Program.cs b/Src/Asp.Net/SqlServerTest/Program.cs index 7e7e4d511..b696337bf 100644 --- a/Src/Asp.Net/SqlServerTest/Program.cs +++ b/Src/Asp.Net/SqlServerTest/Program.cs @@ -18,7 +18,11 @@ namespace OrmTest static void Main(string[] args) { - // /***Unit Test***/ + /***BUG repair test***/ + new BugTest.Bug1().Init(); + new BugTest.Bug2().Init(); + + /***Unit Test***/ new SqlRemark(2).Init(); new Select(1).Init(); new Field(1).Init(); @@ -56,9 +60,6 @@ namespace OrmTest Demo.Mapper.Init(); Demo.ExtEntity.Init(); Demo.VersionValidation.Init(); - - /***BUG repair test***/ - new BugTest.Bug1().Init(); } } } diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj index f6e029cc8..19d3e286a 100644 --- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj +++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj @@ -49,6 +49,7 @@ +