-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Stan B edited this page Apr 30, 2014
·
13 revisions
The engine is a wrapper around Microsoft Microsoft.Data.Schema.ScriptDom.SqlTSql100Parser which parses TSQL into graph of objects. Engine knows how to get available rules and can run one or many rules against given TSQL
This is where the rules are defined. Two main group of classes: Visitors These are custom subclasses of Visitor which are being called during parsing Rules Custom rules that hooked up to the visitors. All rules are derived from Rule class;
public abstract class Rule
{
protected Visitor Visitor { get; set; }
protected List<RuleProblem> Problems {get; set;}
public Rule()
{
Problems = new List<RuleProblem>();
}
public abstract IList<RuleProblem> Analyze(RuleContext context);
protected void AddProblem(string problemDescription)
{
Problems.Add(new RuleProblem(this, problemDescription, Visitor.SqlFragment));
}
}
This is ServiceStack facade. The idea behind it is that any client Web Forms, SSMS Add-in or other can call the service and ask what rules are available and check syntax of a given TSQL
There are unit and integration testing projects and also some common classes