private void ValidateInsertedValue(IExecutionService service, IDbTransaction tran, int expectedValue, int returnedId, string executedSql) { string sql = "SELECT VAL FROM DUMMY" + MachineName + " WHERE ID = " + returnedId; using (IDbCommand cmd = service.CreateCommand(tran, sql)) { int insertedValue = (int)Convert.ChangeType(service.ExecuteScalar(cmd), typeof(int)); AssertEqual(expectedValue, insertedValue, string.Format(errorMessageFormat, "CreateEntityRetrievingId", executedSql)); } }
public bool TransactionExists(IDbTransaction trans) { IExecutionService executionService = DatabaseServices.ExecutionService; if (trans.Connection == null) { return(false); } IDbCommand sqlCmd = executionService.CreateCommand(trans, TRANSCOUNT_QUERY); int i = (int)executionService.ExecuteScalar(sqlCmd); return(i > 0); }