Browse Source

-

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
f6dd14c66b
  1. 15
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

15
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -596,13 +596,10 @@ namespace SqlSugar
} }
public virtual int Count() public virtual int Count()
{ {
MappingTableList expMapping = new MappingTableList();
if (QueryBuilder.EntityName== "ExpandoObject" && this.Context.MappingTables.Any(it => it.EntityName == "ExpandoObject")) if (QueryBuilder.EntityName== "ExpandoObject" && this.Context.MappingTables.Any(it => it.EntityName == "ExpandoObject"))
{ {
if (OldMappingTableList == null) expMapping.Add("ExpandoObject", this.Context.MappingTables.First(it => it.EntityName == "ExpandoObject").DbTableName);
{
OldMappingTableList = new MappingTableList();
}
OldMappingTableList.Add("ExpandoObject", this.Context.MappingTables.First(it => it.EntityName == "ExpandoObject").DbTableName);
} }
InitMapping(); InitMapping();
QueryBuilder.IsCount = true; QueryBuilder.IsCount = true;
@ -618,6 +615,14 @@ namespace SqlSugar
} }
RestoreMapping(); RestoreMapping();
QueryBuilder.IsCount = false; QueryBuilder.IsCount = false;
if (expMapping.Count > 0)
{
if (this.QueryableMappingTableList == null)
{
this.QueryableMappingTableList = new MappingTableList();
}
this.QueryableMappingTableList.Add(expMapping.First());
}
return result; return result;
} }

Loading…
Cancel
Save