I have a C# Service from Which I get the data from DataBase using Dapper Repository and I don'have SQL query to append it executes in a single statement For Example:
public CreativeMediaTypeViewModel GetCreativeMediaType(string ContractNumber, int SellerID, int CreativeClassID)
{
StringBuilder strSQL = new StringBuilder();
strSQL.AppendFormat(@" SELECT DISTINCT PurchasedSiteTypeMediaType.MediaType_bmID, MediaTypeName,Acronym,@CreativeClassID AS CreativeClassID
FROM PurchasedSiteTypeMediaType INNER JOIN MediaType_bm ON MediaType_bm.MediaType_bmID = PurchasedSiteTypeMediaType.MediaType_bmID
WHERE ContractNumber = @ContractNumber
AND PurchasedSiteTypeMediaType.SellerID = @SellerID
AND MediaType_bm.TrackingMethod <> 'Supplies' ");
var _parameters = new DynamicParameters();
_parameters.Add("@SellerID", SellerID);
_parameters.Add("@ContractNumber", ContractNumber);
_parameters.Add("@CreativeClassID", CreativeClassID);
var result = _creativeDapperRepository.ExecuteQuery<CreativeMediaTypeViewModel>(strSQL.ToString(), _parameters).FirstOrDefault();
return result;
}
In this Method Which is better for better performance string or StringBuilder?