Bagikan melalui


Create and Register Additional Rules for Analyzing Database Code

Visual Studio Premium and Visual Studio Ultimate include code analysis rules to report on Transact-SQL design issues, naming issues, and performance warnings in your database code. For more information, see Analyzing Database Code to Improve Code Quality.

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 Visual Studio.

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 Visual Studio. 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

Reference

Microsoft.Data.Schema.StaticCodeAnalysis

Concepts

Analyzing Database Code to Improve Code Quality

Extending the Database Features of Visual Studio

Analyzing Application Quality by Using Code Analysis Tools