Files
SQLLint/SQLLinter/Infrastructure/Rules/TempTableDropRule.cs

19 lines
560 B
C#

using Microsoft.SqlServer.TransactSql.ScriptDom;
using SQLLinter.Common;
namespace SQLLinter.Infrastructure.Rules;
public class TempTableDropRule : BaseRuleVisitor
{
public override string Text => "Нежелательно использовать DROP временных таблиц: {0}";
public override void Visit(DropTableStatement node)
{
var check = node.Objects.Where(o => o.BaseIdentifier.Value.StartsWith("#"));
if (check.Any())
{
AddViolation(node, string.Join(", ", check));
}
}
}