From 1f761dc4e06eea8de76a2b6a1d0a711ba02f462e Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 21 Jul 2017 12:14:13 +0800 Subject: [PATCH] 4.2.1.7 --- .../QueryableProvider/QueryableAccessory.cs | 1 + .../QueryableProvider/QueryableProvider.cs | 15 +++++++++++---- Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableAccessory.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableAccessory.cs index 5782cd62f..f9fba01b0 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableAccessory.cs @@ -10,5 +10,6 @@ namespace SqlSugar public class QueryableAccessory { protected ILambdaExpressions _LambdaExpressions; + protected bool _RestoreMapping = true; } } diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 41516fb47..22e209b0c 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -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 ToList() @@ -516,11 +519,15 @@ namespace SqlSugar } public virtual List ToPageList(int pageIndex, int pageSize, ref int totalNumber) { + _RestoreMapping = false; + List result = null; totalNumber = this.Count(); if (totalNumber == 0) - return new List(); + result = new List(); else - return ToPageList(pageIndex, pageSize); + result = ToPageList(pageIndex, pageSize); + _RestoreMapping = true; + return result; } public virtual KeyValuePair> ToSql() @@ -671,7 +678,7 @@ namespace SqlSugar } protected void RestoreMapping() { - if (IsAs) + if (IsAs && _RestoreMapping) { this.Context.MappingTables = OldMappingTableList == null ? new MappingTableList() : OldMappingTableList; } diff --git a/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs b/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs index 6525a91bd..0332eb59b 100644 --- a/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs +++ b/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs @@ -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")]