This commit is contained in:
sunkaixuan
2017-04-27 01:11:34 +08:00
parent 7ced23ea0a
commit 576f5caf64
2 changed files with 41 additions and 33 deletions

View File

@@ -209,64 +209,76 @@ namespace SqlSugar
return this; return this;
} }
public ISugarQueryable<T> Skip(int index) public ISugarQueryable<T> Skip(int num)
{ {
throw new NotImplementedException(); SqlBuilder.LambadaQueryBuilder.Skip = num;
return this;
} }
public ISugarQueryable<T> Take(int num) public ISugarQueryable<T> Take(int num)
{ {
throw new NotImplementedException(); SqlBuilder.LambadaQueryBuilder.Take = num;
return this;
} }
public T Single() public T Single()
{ {
throw new NotImplementedException(); if (SqlBuilder.LambadaQueryBuilder.OrderByValue.IsNullOrEmpty())
}
public T SingleOrDefault()
{ {
throw new NotImplementedException(); SqlBuilder.LambadaQueryBuilder.OrderByValue = " ORDER BY GETDATE()";
}
SqlBuilder.LambadaQueryBuilder.Skip=0;
SqlBuilder.LambadaQueryBuilder.Take=1;
var reval = this.ToList();
if (reval.IsValuable())
{
return reval.SingleOrDefault();
}
else {
return default(T);
}
} }
public T Single(Expression<Func<T, bool>> expression) public T Single(Expression<Func<T, bool>> expression)
{ {
throw new NotImplementedException(); _Where(expression);
} return Single();
public T SingleOrDefault(Expression<Func<T, bool>> expression)
{
throw new NotImplementedException();
} }
public T First() public T First()
{ {
throw new NotImplementedException(); if (SqlBuilder.LambadaQueryBuilder.OrderByValue.IsNullOrEmpty())
}
public T FirstOrDefault()
{ {
throw new NotImplementedException(); SqlBuilder.LambadaQueryBuilder.OrderByValue = " ORDER BY GETDATE()";
}
SqlBuilder.LambadaQueryBuilder.Skip = 0;
SqlBuilder.LambadaQueryBuilder.Take = 1;
var reval = this.ToList();
if (reval.IsValuable())
{
return reval.FirstOrDefault();
}
else
{
return default(T);
}
} }
public T First(Expression<Func<T, bool>> expression) public T First(Expression<Func<T, bool>> expression)
{ {
throw new NotImplementedException(); _Where(expression);
} return First();
public T FirstOrDefault(Expression<Func<T, bool>> expression)
{
throw new NotImplementedException();
} }
public bool Any(Expression<Func<T, bool>> expression) public bool Any(Expression<Func<T, bool>> expression)
{ {
throw new NotImplementedException(); _Where(expression);
return Any();
} }
public bool Any() public bool Any()
{ {
throw new NotImplementedException(); return this.ToList().IsValuable();
} }
public ISugarQueryable<TResult> Select<T2, TResult>(Expression<Func<T2, TResult>> expression) public ISugarQueryable<TResult> Select<T2, TResult>(Expression<Func<T2, TResult>> expression)

View File

@@ -50,15 +50,11 @@ namespace SqlSugar
ISugarQueryable<T> Take(int num); ISugarQueryable<T> Take(int num);
T Single(); T Single();
T SingleOrDefault();
T Single(Expression<Func<T, bool>> expression); T Single(Expression<Func<T, bool>> expression);
T SingleOrDefault(Expression<Func<T, bool>> expression);
T First(); T First();
T FirstOrDefault();
T First(Expression<Func<T, bool>> expression); T First(Expression<Func<T, bool>> expression);
T FirstOrDefault(Expression<Func<T, bool>> expression);
bool Any(Expression<Func<T, bool>> expression); bool Any(Expression<Func<T, bool>> expression);
bool Any(); bool Any();
ISugarQueryable<TResult> Select<T2, TResult>(Expression<Func<T2, TResult>> expression) ; ISugarQueryable<TResult> Select<T2, TResult>(Expression<Func<T2, TResult>> expression) ;