Resolving external references and filtering SQL database objects in a project

Applies to
ApexSQL Clean

Summary
This article describes how to include external references in analysis and how to filter objects to speed up the process.

Description

Beside internal database references in SQL Server, ApexSQL Clean can also analyze dependencies in external databases and applications.

External databases

To include external SQL Server databases in dependency analysis in the New project dialog under the External databases tab select additional databases:

Selecting external databases for analysis in ApexSQL Clean

All references from the external databases will be shown for a selected object in the Results grid:

Results grid showing all references from external databases

External applications

To include project files from external applications:

  1. Click the Advanced tabs button in the New project dialog
  2. Under the Files tab in the Look up in section:
    1. 2.1. To add an external application project file click the Add button and browse to the project file:

    Select files for dependency analysis window - Adding an external application project file

    Quick tip icon

    Quick tip:

    Using the Add button you can add a specific .NET solution (.sln) file or a .NET project file (.csproj or .vbproj )

    1. 2.2. To add a folder with client code, click the Add folder button:

    Select files for dependency analysis window - adding a folder with client code

    Quick tip icon

    Quick tip:

    Using the Add folder button you can add folders that contain C++, ASP, Delphi, or any other client code

    References from all included files will be shown in the Results grid:

    Results grid showing references from all included files

Customizing file search

To customize the list of files from the added folder to be searched in the analysis process you can filter the list of files using the regular expressions. Under the File Name Patterns option click the Add button to create custom patterns:

In the Add pattern dialog add the pattern expression and click OK:

Quick tip icon

Quick tip:

If the client code was written in C#, then use a file name pattern .cs so only the files containing or ending with .cs are analyzed for SQL dependencies. To match the very last extension, use the file pattern .cs$ in the same way code created in Visual Basic will use the .vb and .vb$ patterns.

The Comments to ignore option contains a list of comments from client code to be ignored. To add a comment template to the list click the Add button:

Using the Comments to ignore option to add a comment template

In the Add comment dialog choose the type of comment:

Choosing the type of comment in the Add Comment dialog

If close delimiter is applied, comment will be treated as multiline, and if close delimiter is left empty, it will be considered as the single line comment.

The Match case option is used to make search for objects in source code files case sensitive and the Match whole word only option is used for matching the whole word only:

Checking the Match case and the Match whole words only options in ApexSQL Clean

Object filter

To customize and speed up the analysis use the under the Object filter tab select the object types for analysis:

Selecting the object types for analysis under the Object filter tab

Object selection can also be used in the ApexSQL Clean CLI for each selected combination by using the Bitwise set and adding a switch “/o:”.