mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 10:10:16 +08:00
Merge branch 'dev' of https://github.com/sunkaixuan/SqlSugar
# Conflicts: # Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite
This commit is contained in:
commit
8878bf7375
@ -116,10 +116,10 @@ namespace OrmTest.UnitTest
|
|||||||
string name = "x";
|
string name = "x";
|
||||||
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
||||||
base.Check(@"UPDATE `STudent` SET
|
base.Check(@"UPDATE `STudent` SET
|
||||||
`SchoolId` = @Const0 , `Name` = @const3 WHERE ( `ID` = @Id1 )", new List<SugarParameter>() {
|
`SchoolId` = @Const1 , `Name` = @Const0 WHERE ( `ID` = @Id2 )", new List<SugarParameter>() {
|
||||||
new SugarParameter("@const3","x"),
|
new SugarParameter("@Const1",18),
|
||||||
new SugarParameter("@Const0",18),
|
new SugarParameter("@Const0","x"),
|
||||||
new SugarParameter("@Id1",11)},
|
new SugarParameter("@Id2",11)},
|
||||||
t10.Key,
|
t10.Key,
|
||||||
t10.Value,
|
t10.Value,
|
||||||
"Update 10 error"
|
"Update 10 error"
|
||||||
|
88
Src/Asp.Net/SqlServerTest/Demos/CS_TeacherStudent.cs
Normal file
88
Src/Asp.Net/SqlServerTest/Demos/CS_TeacherStudent.cs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OrmTest.Demo
|
||||||
|
{
|
||||||
|
public class CS_TeacherStudent
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:-
|
||||||
|
/// Default:(newid())
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public Guid tabId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:教师Id
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string teacherId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:教师课程Id(对应TeacherCourse.tabId)
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string teacherCourseId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:教学头内的序号
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public int? ordInTC {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:学号
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string stuId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:学生姓名
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string stuName {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:性别
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string stuSex {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:所属院系Id
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string deptId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:所属班级Id
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string classId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:不能对应班级代码的班级名称时源班级名称
|
||||||
|
/// Default:-
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string sclassName {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:-
|
||||||
|
/// Default:((1))
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public int? validFlag {get;set;}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -54,6 +54,7 @@
|
|||||||
<Compile Include="Demos\8_JoinSql.cs" />
|
<Compile Include="Demos\8_JoinSql.cs" />
|
||||||
<Compile Include="Demos\5_DbFirst.cs" />
|
<Compile Include="Demos\5_DbFirst.cs" />
|
||||||
<Compile Include="Demos\4_Delete.cs" />
|
<Compile Include="Demos\4_Delete.cs" />
|
||||||
|
<Compile Include="Demos\CS_TeacherStudent.cs" />
|
||||||
<Compile Include="Demos\DemoBase.cs" />
|
<Compile Include="Demos\DemoBase.cs" />
|
||||||
<Compile Include="Demos\3_Insert.cs" />
|
<Compile Include="Demos\3_Insert.cs" />
|
||||||
<Compile Include="Demos\1_Query.cs" />
|
<Compile Include="Demos\1_Query.cs" />
|
||||||
|
@ -116,10 +116,10 @@ namespace OrmTest.UnitTest
|
|||||||
string name = "x";
|
string name = "x";
|
||||||
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
||||||
base.Check(@"UPDATE [STudent] SET
|
base.Check(@"UPDATE [STudent] SET
|
||||||
[SchoolId] = @Const0 , [Name] = @const3 WHERE ( [ID] = @Id1 )", new List<SugarParameter>() {
|
[SchoolId] = @Const1 , [Name] = @Const0 WHERE ( [ID] = @Id2 )", new List<SugarParameter>() {
|
||||||
new SugarParameter("@const3","x"),
|
new SugarParameter("@Const1",18),
|
||||||
new SugarParameter("@Const0",18),
|
new SugarParameter("@Const0","x"),
|
||||||
new SugarParameter("@Id1",11)},
|
new SugarParameter("@Id2",11)},
|
||||||
t10.Key,
|
t10.Key,
|
||||||
t10.Value,
|
t10.Value,
|
||||||
"Update 10 error"
|
"Update 10 error"
|
||||||
|
@ -59,9 +59,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
base.Expression = item;
|
base.Expression = item;
|
||||||
base.Start();
|
base.Start();
|
||||||
string parameterName = this.Context.SqlParameterKeyWord + "const" + this.ContentIndex;
|
string parameterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const+ this.Context.ParameterIndex;
|
||||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
||||||
this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData));
|
this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData));
|
||||||
|
this.Context.ParameterIndex++;
|
||||||
}
|
}
|
||||||
else if (item is MethodCallExpression)
|
else if (item is MethodCallExpression)
|
||||||
{
|
{
|
||||||
@ -79,7 +80,6 @@ namespace SqlSugar
|
|||||||
base.Expression = item;
|
base.Expression = item;
|
||||||
base.Start();
|
base.Start();
|
||||||
parameter.IsAppendResult();
|
parameter.IsAppendResult();
|
||||||
string parameterName = this.Context.SqlParameterKeyWord + "const" + +this.ContentIndex; ;
|
|
||||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameter.CommonTempData.ObjToString()));
|
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameter.CommonTempData.ObjToString()));
|
||||||
base.Context.Result.CurrentParameter = null;
|
base.Context.Result.CurrentParameter = null;
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,21 @@ namespace SqlSugar
|
|||||||
switch (parameter.Context.ResolveType)
|
switch (parameter.Context.ResolveType)
|
||||||
{
|
{
|
||||||
case ResolveExpressType.WhereSingle:
|
case ResolveExpressType.WhereSingle:
|
||||||
|
Check.ThrowNotSupportedException(expression.ToString());
|
||||||
break;
|
break;
|
||||||
case ResolveExpressType.WhereMultiple:
|
case ResolveExpressType.WhereMultiple:
|
||||||
|
Check.ThrowNotSupportedException(expression.ToString());
|
||||||
break;
|
break;
|
||||||
case ResolveExpressType.SelectSingle:
|
case ResolveExpressType.SelectSingle:
|
||||||
|
Check.Exception(expression.Type == PubConst.DateType, "ThrowNotSupportedException {0} ",expression.ToString());
|
||||||
Select(expression, parameter, true);
|
Select(expression, parameter, true);
|
||||||
break;
|
break;
|
||||||
case ResolveExpressType.SelectMultiple:
|
case ResolveExpressType.SelectMultiple:
|
||||||
|
Check.Exception(expression.Type == PubConst.DateType, "ThrowNotSupportedException {0} ", expression.ToString());
|
||||||
Select(expression, parameter, false);
|
Select(expression, parameter, false);
|
||||||
break;
|
break;
|
||||||
case ResolveExpressType.FieldSingle:
|
case ResolveExpressType.FieldSingle:
|
||||||
|
Check.ThrowNotSupportedException(expression.ToString());
|
||||||
break;
|
break;
|
||||||
case ResolveExpressType.FieldMultiple:
|
case ResolveExpressType.FieldMultiple:
|
||||||
case ResolveExpressType.ArrayMultiple:
|
case ResolveExpressType.ArrayMultiple:
|
||||||
@ -50,7 +55,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
string memberName = expression.Members[i].Name;
|
string memberName = expression.Members[i].Name;
|
||||||
++i;
|
++i;
|
||||||
ResolveNewExpressions(parameter,item, memberName);
|
ResolveNewExpressions(parameter, item, memberName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,6 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
public static string ConnectionString = @"DataSource=F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\Src\Asp.Net\SqliteTest\DataBase\SqlSugar4xTest.sqlite";
|
public static string ConnectionString = @"DataSource=D:\MyGit\SqlSugar\Src\Asp.Net\SqliteTest\DataBase\SqlSugar4xTest.sqlite";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,10 +116,10 @@ namespace OrmTest.UnitTest
|
|||||||
string name = "x";
|
string name = "x";
|
||||||
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
||||||
base.Check(@"UPDATE `STudent` SET
|
base.Check(@"UPDATE `STudent` SET
|
||||||
`SchoolId` = @Const0 , `Name` = @const3 WHERE ( `ID` = @Id1 )", new List<SugarParameter>() {
|
`SchoolId` = @Const1 , `Name` = @Const0 WHERE ( `ID` = @Id2 )", new List<SugarParameter>() {
|
||||||
new SugarParameter("@const3","x"),
|
new SugarParameter("@Const1",18),
|
||||||
new SugarParameter("@Const0",18),
|
new SugarParameter("@Const0","x"),
|
||||||
new SugarParameter("@Id1",11)},
|
new SugarParameter("@Id2",11)},
|
||||||
t10.Key,
|
t10.Key,
|
||||||
t10.Value,
|
t10.Value,
|
||||||
"Update 10 error"
|
"Update 10 error"
|
||||||
|
Loading…
Reference in New Issue
Block a user