You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

57 lines
1.1 KiB

using System.Linq.Expressions;
namespace SqlSugar
{
public class SubTop : ISubOperation
{
public ExpressionContext Context
{
get; set;
}
public Expression Expression
{
get; set;
}
public string Name
{
get
{
return "Top";
}
}
public int Sort
{
get
{
if (this.Context is SqlServerExpressionContext)
{
return 150;
}
else
{
return 490;
}
}
}
public string GetValue(Expression expression)
{
if (this.Context is SqlServerExpressionContext)
{
return "TOP 1";
}
else if (this.Context is OracleExpressionContext)
{
return "ROWNUM=1";
}
else
{
return "limit 0,1";
}
}
}
}