public int ExecuteScalar(string sqlCommand)
{
return base.Database.Execute<int>(delegate
{
int result;
try
{
IDbCommand dbCommand = this.CreateCommand(sqlCommand);
dbCommand.CommandType = CommandType.Text;
result = (int)dbCommand.ExecuteScalar();
}
catch (Exception ex)
{
result = 0;
Logger.Error(
string.Format(
"An error occureding in the ExecuteScalar method with the following sql{0}. Exception:{1}",
sqlCommand,
ex));
}
return result;
});
}