Добавьте файлы проекта.
This commit is contained in:
18
SQLLinter/Infrastructure/Rules/DistinctRule.cs
Normal file
18
SQLLinter/Infrastructure/Rules/DistinctRule.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Microsoft.SqlServer.TransactSql.ScriptDom;
|
||||
using SQLLinter.Common;
|
||||
|
||||
namespace SQLLinter.Infrastructure.Rules;
|
||||
|
||||
public class DistinctRule : BaseRuleVisitor
|
||||
{
|
||||
public override string Text => "Избегать DISTINCT, отдавать предпочтение GROUP BY.";
|
||||
|
||||
public override void Visit(SelectStatement node)
|
||||
{
|
||||
var query = node.QueryExpression as QuerySpecification;
|
||||
if (query != null && query.SelectElements.Any() && query.UniqueRowFilter == UniqueRowFilter.Distinct)
|
||||
{
|
||||
AddViolation(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user