Browse Source

code optimization

pull/1/MERGE
SUNKAIXUAN 4 years ago
parent
commit
e8e0673344
  1. 4
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

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

@ -460,6 +460,10 @@ namespace SqlSugar
public virtual T InSingle(object pkValue) public virtual T InSingle(object pkValue)
{ {
if (pkValue == null)
{
pkValue = -1;
}
Check.Exception(this.QueryBuilder.SelectValue.HasValue(), "'InSingle' and' Select' can't be used together,You can use .Select(it=>...).Single(it.id==1)"); Check.Exception(this.QueryBuilder.SelectValue.HasValue(), "'InSingle' and' Select' can't be used together,You can use .Select(it=>...).Single(it.id==1)");
var list = In(pkValue).ToList(); var list = In(pkValue).ToList();
if (list == null) return default(T); if (list == null) return default(T);

Loading…
Cancel
Save