Q:

Name Can Be Simplified - Visual Studio 2019 Override

I have the following line of code in my ASP.NET project: 
    public virtual async Task<bool> Delete(int id)
    {
        var entity = LoadById(id);
        using (IDbConnection cn = new SqlConnection(_conn))
        {
            cn.Open();
            /* Do Not Remove <T> Variables, its required even though the compiler notes its not required */
            var result = await cn.DeleteAsync<T>(entity);

            return result;
        }
    }

Here is the class definition: 
public abstract class DatabaseRepository<T> where T : class, IDatabaseModel, new()

Visual studio 2019 is displaying a warning that I need to remove the T variable from my DeleteAsync method because it is not needed and can be simplified. The problem is that it is needed for the extension I am using (Dapper). As soon as I remove the T reference, my code will throw a runtime exception. 
From: 
var result = await cn.DeleteAsync<T>(entity);

To:
var result = await cn.DeleteAsync(entity);

My first thought was to add a comment next to this line to prevent other developers form removing it. However I got to thinking that there must be some type of override I can do in the code to prevent it from showing as a warning. Some type of special comment or something that I can put above the line to prevent visual studio from displaying the message. So far I've checked online and can't find anything. I'm looking for something I can put in the code not a setting change in Visual Studio. 

A:

Rather than adding a comment, add a SuppressMessage which will prevent the warning in the first place.
[SuppressMessage("Reason", "Whatever the id is", Justification="Do Not Remove <T> Variables, its required even though the compiler notes its not required")]
public virtual async Task<bool> Delete(int id)
{
    var entity = LoadById(id);
    using (IDbConnection cn = new SqlConnection(_conn))
    {
        cn.Open();
        var result = await cn.DeleteAsync<T>(entity);

        return result;
    }
}

