protected override string GetCommandText(string commandText)
{
if (commandText == null)
{
throw new ArgumentNullException("commandText");
}
if (this.IsStoredProcedureCall(commandText))
{
var invocationCommandLength = this.SqlCharacters.StoredProcedureInvocationCommand.Length;
var firstParameterPosition = SqlUtility.GetFirstParameterPosition(commandText);
if (commandText.Contains("("))
{
firstParameterPosition--;
}
if (firstParameterPosition > invocationCommandLength)
{
return commandText
.Substring(invocationCommandLength, firstParameterPosition - invocationCommandLength)
.Trim();
}
else
{
return commandText.Substring(invocationCommandLength, commandText.Length - invocationCommandLength).Trim();
}
}
return commandText;
}