mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
-
This commit is contained in:
@@ -39,7 +39,12 @@ namespace OrmTest.UnitTest
|
|||||||
#region dr ot entity
|
#region dr ot entity
|
||||||
db.IgnoreComumns.Add("TestId", "Student");
|
db.IgnoreComumns.Add("TestId", "Student");
|
||||||
var d5 = db.Queryable<Student>().ToList();
|
var d5 = db.Queryable<Student>().ToList();
|
||||||
var d51 = db.Queryable<Student>().GroupBy(it=>it.Id).OrderBy(it=>it.Id).Select(it=>it.Id).ToSql();
|
var gos = db.Queryable<Student>()
|
||||||
|
.With(SqlWith.NoLock)
|
||||||
|
.GroupBy(it=>it.Id)
|
||||||
|
.OrderBy(it=>it.Id)
|
||||||
|
.Select(it=>it.Id).ToSql();
|
||||||
|
base.Check("SELECT [Id] FROM [Student] WITH(NOLOCK) GROUP BY [Id] ORDER BY [Id] ASC", null, gos.Key,null, "基本查询出错");
|
||||||
var dr3 = db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name=it.Name,Student=it}).ToList();
|
var dr3 = db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name=it.Name,Student=it}).ToList();
|
||||||
var dr0 = db.Queryable<Student>().Select(it => new { id=it.Id,w=new { x=it } }).ToList();
|
var dr0 = db.Queryable<Student>().Select(it => new { id=it.Id,w=new { x=it } }).ToList();
|
||||||
var dr1 = db.Queryable<Student>().Select(it => new { newid = it.Id }).ToList();
|
var dr1 = db.Queryable<Student>().Select(it => new { newid = it.Id }).ToList();
|
||||||
|
@@ -436,6 +436,12 @@ namespace SqlSugar
|
|||||||
GroupBy(orderByValue.GetResultString());
|
GroupBy(orderByValue.GetResultString());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ISugarQueryable<T> With(string withString)
|
||||||
|
{
|
||||||
|
SqlBuilder.LambadaQueryBuilder.TableWithString = withString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -217,7 +217,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var result = Builder.GetTranslationTableName(EntityName) + TableWithString;
|
var result = Builder.GetTranslationTableName(EntityName);
|
||||||
|
if (this.TableWithString.IsValuable()) {
|
||||||
|
result += " " + TableWithString;
|
||||||
|
}
|
||||||
if (this.TableShortName.IsValuable())
|
if (this.TableShortName.IsValuable())
|
||||||
{
|
{
|
||||||
result += " " + TableShortName;
|
result += " " + TableShortName;
|
||||||
|
13
SqlSugar/Entities/SqlWith.cs
Normal file
13
SqlSugar/Entities/SqlWith.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public partial class SqlWith
|
||||||
|
{
|
||||||
|
public const string NoLock = "WITH(NOLOCK) ";
|
||||||
|
}
|
||||||
|
}
|
@@ -12,6 +12,7 @@ namespace SqlSugar
|
|||||||
SqlSugarClient Context { get; set; }
|
SqlSugarClient Context { get; set; }
|
||||||
ISqlBuilder SqlBuilder { get; set; }
|
ISqlBuilder SqlBuilder { get; set; }
|
||||||
|
|
||||||
|
ISugarQueryable<T> With(string withString);
|
||||||
ISugarQueryable<T> AddParameters(object pars);
|
ISugarQueryable<T> AddParameters(object pars);
|
||||||
ISugarQueryable<T> AddParameters(SugarParameter[] pars);
|
ISugarQueryable<T> AddParameters(SugarParameter[] pars);
|
||||||
ISugarQueryable<T> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type=JoinType.Left);
|
ISugarQueryable<T> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type=JoinType.Left);
|
||||||
|
@@ -89,6 +89,7 @@
|
|||||||
<Compile Include="Entities\DbColumnInfo.cs" />
|
<Compile Include="Entities\DbColumnInfo.cs" />
|
||||||
<Compile Include="Entities\DbTableInfo.cs" />
|
<Compile Include="Entities\DbTableInfo.cs" />
|
||||||
<Compile Include="Entities\Mapping\IgnoreComumn.cs" />
|
<Compile Include="Entities\Mapping\IgnoreComumn.cs" />
|
||||||
|
<Compile Include="Entities\SqlWith.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\CommonTempDataType.cs" />
|
<Compile Include="ExpressionsToSql\Common\CommonTempDataType.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\MethodCallExpressionModel.cs" />
|
<Compile Include="ExpressionsToSql\Common\MethodCallExpressionModel.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Method\DefaultDbMethod.cs" />
|
<Compile Include="ExpressionsToSql\Method\DefaultDbMethod.cs" />
|
||||||
|
Reference in New Issue
Block a user