mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 02:35:04 +08:00
Add db.SqlQueryable
This commit is contained in:
@@ -28,6 +28,13 @@ namespace OrmTest.Demo
|
|||||||
Simple();
|
Simple();
|
||||||
Async();
|
Async();
|
||||||
Subqueryable();
|
Subqueryable();
|
||||||
|
SqlQueryable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SqlQueryable()
|
||||||
|
{
|
||||||
|
var db = GetInstance();
|
||||||
|
var list = db.SqlQueryable<Student>("select * from student").ToPageList(1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Subqueryable()
|
private static void Subqueryable()
|
||||||
|
@@ -75,6 +75,9 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return UtilMethods.GetPackTable(sql,shortName);
|
return UtilMethods.GetPackTable(sql,shortName);
|
||||||
}
|
}
|
||||||
|
public virtual string GetDefaultShortName() {
|
||||||
|
return "t";
|
||||||
|
}
|
||||||
public virtual void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex)
|
public virtual void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex)
|
||||||
{
|
{
|
||||||
UtilMethods.RepairReplicationParameters(ref appendSql,parameters,addIndex);
|
UtilMethods.RepairReplicationParameters(ref appendSql,parameters,addIndex);
|
||||||
|
@@ -27,6 +27,7 @@ namespace SqlSugar
|
|||||||
string GetTranslationColumnName(string propertyName);
|
string GetTranslationColumnName(string propertyName);
|
||||||
string GetNoTranslationColumnName(string name);
|
string GetNoTranslationColumnName(string name);
|
||||||
string GetPackTable(string sql,string shortName);
|
string GetPackTable(string sql,string shortName);
|
||||||
|
string GetDefaultShortName();
|
||||||
void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex);
|
void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -337,6 +337,14 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region SqlQueryable
|
||||||
|
public ISugarQueryable<T> SqlQueryable<T>(string sql) where T : class, new()
|
||||||
|
{
|
||||||
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
|
||||||
|
return this.Queryable<T>().AS(sqlBuilder.GetPackTable(sql, sqlBuilder.GetDefaultShortName()));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Insertable
|
#region Insertable
|
||||||
public virtual IInsertable<T> Insertable<T>(T[] insertObjs) where T : class, new()
|
public virtual IInsertable<T> Insertable<T>(T[] insertObjs) where T : class, new()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user