From e3e4026e919444f9736b39f283c7d368b59b431c Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 10 Jul 2022 14:14:38 +0800 Subject: [PATCH] Repair distinct count bug --- .../Abstract/QueryableProvider/QueryableProvider.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index be146509a..87926d15d 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -1143,7 +1143,8 @@ namespace SqlSugar this.QueryBuilder.OrderByValue == null && this.QueryBuilder.PartitionByValue == null&& this.QueryBuilder.SelectValue==null&& - this.QueryBuilder.Includes == null) + this.QueryBuilder.Includes == null&& + this.QueryBuilder.IsDistinct==false) { return this.Clone().Select(" COUNT(1) ").ToList().First(); @@ -2154,7 +2155,8 @@ namespace SqlSugar this.QueryBuilder.OrderByValue == null && this.QueryBuilder.PartitionByValue == null && this.QueryBuilder.SelectValue == null && - this.QueryBuilder.Includes == null) + this.QueryBuilder.Includes == null&& + this.QueryBuilder.IsDistinct==false) { var list = await this.Clone().Select(" COUNT(1) ").ToListAsync(); return list.First();