public int Check404Version()
{
return Database.Execute<int>(() =>
{
string sqlCommand = "dbo.bvn_notfoundversion";
int version = -1;
try
{
// base.Database.Connection.Open();
DbCommand command = this.CreateCommand();
command.Parameters.Add(this.CreateReturnParameter());
command.CommandText = sqlCommand;
command.CommandType = CommandType.StoredProcedure;
// command.Connection = base.Database.Connection;
command.ExecuteNonQuery();
version = Convert.ToInt32(this.GetReturnValue(command).ToString());
}
catch (SqlException)
{
Logger.Information("Stored procedure not found. Creating it.");
return version;
}
catch (Exception ex)
{
Logger.Error(string.Format("Error during NotFoundHandler version check:{0}", ex));
}
finally
{
// base.Database.Connection.Close();
}
return version;
});
}