20 lines
620 B
C#
20 lines
620 B
C#
using Microsoft.SqlServer.TransactSql.ScriptDom;
|
|
using SQLLinter.Common;
|
|
using SQLLinter.Common.Helpers;
|
|
|
|
namespace SQLLinter.Infrastructure.Rules;
|
|
|
|
public class CrossDatabaseReferenceRule : BaseRuleVisitor, IRule
|
|
{
|
|
|
|
public override string Text => "Запрещено указывать имя базы данных в объекте. Используйте синонимы: {0}";
|
|
|
|
public override void Visit(NamedTableReference node)
|
|
{
|
|
if (node.SchemaObject.DatabaseIdentifier != null)
|
|
{
|
|
AddViolation(node, SQLHelpers.ObjectGetFullName(node.SchemaObject));
|
|
}
|
|
}
|
|
}
|