This commit is contained in:
sunkaixuan 2017-07-21 12:14:13 +08:00
parent fb32fc3a6e
commit 1f761dc4e0
3 changed files with 14 additions and 6 deletions

View File

@ -10,5 +10,6 @@ namespace SqlSugar
public class QueryableAccessory
{
protected ILambdaExpressions _LambdaExpressions;
protected bool _RestoreMapping = true;
}
}

View File

@ -490,8 +490,11 @@ namespace SqlSugar
}
public virtual DataTable ToDataTablePage(int pageIndex, int pageSize, ref int totalNumber)
{
_RestoreMapping = false;
totalNumber = this.Count();
return ToDataTablePage(pageIndex, pageSize);
var result = ToDataTablePage(pageIndex, pageSize);
_RestoreMapping = true;
return result;
}
public virtual List<T> ToList()
@ -516,11 +519,15 @@ namespace SqlSugar
}
public virtual List<T> ToPageList(int pageIndex, int pageSize, ref int totalNumber)
{
_RestoreMapping = false;
List<T> result = null;
totalNumber = this.Count();
if (totalNumber == 0)
return new List<T>();
result = new List<T>();
else
return ToPageList(pageIndex, pageSize);
result = ToPageList(pageIndex, pageSize);
_RestoreMapping = true;
return result;
}
public virtual KeyValuePair<string, List<SugarParameter>> ToSql()
@ -671,7 +678,7 @@ namespace SqlSugar
}
protected void RestoreMapping()
{
if (IsAs)
if (IsAs && _RestoreMapping)
{
this.Context.MappingTables = OldMappingTableList == null ? new MappingTableList() : OldMappingTableList;
}

View File

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.1.6")]
[assembly: AssemblyFileVersion("4.2.1.6")]
[assembly: AssemblyVersion("4.2.1.7")]
[assembly: AssemblyFileVersion("4.2.1.7")]