Browse Source

Oracle Union all bug

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
85a15a1404
  1. 12
      Src/Asp.Net/OracleTest/Demos/1_Query.cs
  2. 12
      Src/Asp.Net/SqlServerTest/Demos/1_Query.cs
  3. 2
      Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs

12
Src/Asp.Net/OracleTest/Demos/1_Query.cs

@ -336,6 +336,18 @@ namespace OrmTest.Demo
var list8 = db.Queryable<Student, School, School>((st, sc, sc2) => st.SchoolId == sc.Id && sc.Id == sc2.Id) var list8 = db.Queryable<Student, School, School>((st, sc, sc2) => st.SchoolId == sc.Id && sc.Id == sc2.Id)
.OrderBy(st=>st.Id) .OrderBy(st=>st.Id)
.Select((st, sc, sc2) => new { st.Name, st.Id, schoolName = sc.Name, schoolName2 = sc2.Name }).ToPageList(1, 2); .Select((st, sc, sc2) => new { st.Name, st.Id, schoolName = sc.Name, schoolName2 = sc2.Name }).ToPageList(1, 2);
var q1 = db.Queryable<Student>().Select(it => new Student()
{
Id=it.Id,
Name="a"
});
var q2 = db.Queryable<Student>().Select(it => new Student()
{
Id = it.Id,
Name = "b"
});
var unionAllList=db.Union(q1, q2).ToList();
} }
public static void Funs() public static void Funs()
{ {

12
Src/Asp.Net/SqlServerTest/Demos/1_Query.cs

@ -539,6 +539,18 @@ namespace OrmTest.Demo
id=st1.Id, id=st1.Id,
name=st2.Name name=st2.Name
}).ToList(); }).ToList();
var q1 = db.Queryable<Student>().Select(it => new Student()
{
Id = it.Id,
Name = "a"
});
var q2 = db.Queryable<Student>().Select(it => new Student()
{
Id = it.Id,
Name = "b"
});
var unionAllList = db.Union(q1, q2).ToList();
} }
public static void Funs() public static void Funs()
{ {

2
Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs

@ -78,7 +78,7 @@ namespace SqlSugar
//Compatible with.NET CORE parameters case //Compatible with.NET CORE parameters case
var name = parameter.ParameterName; var name = parameter.ParameterName;
string newName = name +append+ addIndex; string newName = name +append+ addIndex;
appendSql = appendSql.Replace(name, newName); appendSql =Regex.Replace(appendSql,name,newName,RegexOptions.IgnoreCase);
parameter.ParameterName = newName; parameter.ParameterName = newName;
} }
} }

Loading…
Cancel
Save