SubTop 表达式怎么继承 返回

这是SubTop 类,我在实现一个新的自定义数据库, 怎么继承GetValue
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace SqlSugar
{
public class SubTop : ISubOperation
{
public bool HasWhere
{
get; set;
}
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 || this.Context.GetType().Name.Contains("Access"))
{
return 150;
}
else if (this.Context is OracleExpressionContext) {
return 401;
}
else
{
return 490;
}
}
}
public string GetValue(Expression expression)
{
if (this.Context is SqlServerExpressionContext|| this.Context.GetType().Name.Contains("Access"))
{
return "TOP 1";
}
else if (this.Context is OracleExpressionContext)
{
return (HasWhere?"AND":"WHERE")+ " ROWNUM=1";
}
else if (this.Context is PostgreSQLExpressionContext)
{
return "limit 1";
}
else if (this.Context.GetLimit()!=null)
{
return this.Context.GetLimit();
}
else
{
return "limit 0,1";
}
}
}
}
热忱回答(2)
-
fate sta VIP0
2022/12/5return this.Context.GetLimit(); 这个方法可以重载的
0 回复 -
fate sta VIP0
2022/12/5你新建的库重写 GetLimit 方法就行了
0 回复