Is there a way to apply custom code inspection patterns to string contents?


Our team is looking to curb the use of certain tables and views in our database. While inline SQL is certainly discouraged, it is still used occasionally. Therefore, I was looking to modify our team's ReSharper settings so that any strings containing these table names are flagged. So far I have been unable to achieve this.

An example would be something like:

var sqlString = "SELECT id, name FROM dbo.tableThatShouldNotBeUsed";

I want ReSharper to flag that line because the table name in the inline SQL is something I do not want my developers to use.

We are using ReSharper 7.1, if it helps.

Thank you.
1 comment
Comment actions Permalink

There's nothing built in that will do this for you. You could write a plugin that looks for string literals and checks the constants. You can find out more here:


Please sign in to leave a comment.