Create and Register Additional Rules for Analyzing Database Code

Visual Studio Team System Database Edition includes code analysis rules to report on Transact-SQL (T-SQL) design issues, naming issues, and performance warnings in your database code. For more information, see Improving Database Code with Static Analysis.

If the built-in code analysis rules do not include coverage for a specific Transact-SQL issue that you want included, you can create custom database code analysis rules by extending the database code analysis rules feature.

Common Tasks

The following table lists descriptions of common tasks that support creating, registering, and deploying custom database code analysis rules, plus links to more information about how you can successfully complete these tasks.

Common Tasks

Supporting Content

Learn more about how to extend the static code analysis rules feature: You can read about the basic concepts and architecture used in implementing custom code analysis rules for Database Edition.

Create an assembly as a starting point for a custom SQL static code analysis rule: Learn the steps that are required to create a SQL code analysis rule for Database Edition. The walkthrough creates a rule that avoids using the WAITFOR DELAY statement in Transact-SQL code. The walkthrough also demonstrates how to register the assembly.

You can create all your rules in a single assembly or among several assemblies, depending on how you want the rules distributed to your team.

Distribute custom SQL code analysis rules to team members: After you verify that your rule works correctly, you can distribute it to your team. You can ask each team member to install and register the feature extension manually, or you can create a simple installation program for it.

Create Custom Database Refactoring Types or Targets

Generate Specialized Test Data with a Custom Data Generator

Define Custom Conditions for Database Unit Tests

See Also

Concepts

Improving Database Code with Static Analysis

Extending the Features of Database Edition

Reference

Microsoft.Data.Schema.StaticCodeAnalysis

Other Resources

Writing Quality Code