This commit is contained in:
sunkaixuan
2017-04-27 01:17:46 +08:00
parent 576f5caf64
commit 53d6e75efc
2 changed files with 7 additions and 1 deletions

View File

@@ -340,7 +340,11 @@ namespace SqlSugar
public int Count()
{
throw new NotImplementedException();
SqlBuilder.LambadaQueryBuilder.IsCount = true;
var sql = SqlBuilder.LambadaQueryBuilder.ToSqlString();
var reval= Context.Database.GetInt(sql, SqlBuilder.LambadaQueryBuilder.QueryPars.ToArray());
SqlBuilder.LambadaQueryBuilder.IsCount = false;
return reval;
}
public TResult Max<TResult>(string maxField)

View File

@@ -28,6 +28,7 @@ namespace SqlSugar
#endregion
#region Splicing basic
public bool IsCount { get; set; }
public int? Skip { get; set; }
public int? Take { get; set; }
public string OrderByValue { get; set; }
@@ -174,6 +175,7 @@ namespace SqlSugar
{
get
{
if (this.IsCount) return " COUNT(1) ";
string reval = string.Empty;
if (this.SelectValue == null || this.SelectValue is string)
{