public static IEnumerable <T> Get <T>(string catalog, string sql, bool isStoredProcedure, params object[] args) { try { using (Database db = new Database(GetConnectionString(catalog), ProviderName)) { return(db.QuerySP <T>(sql, args)); } } catch (NpgsqlException ex) { if (ex.Code.StartsWith("P")) { string errorMessage = GetDBErrorResource(ex); throw new MixERPException(errorMessage, ex); } throw new MixERPException(ex.Message, ex); } }
public static IEnumerable <T> Get <T>(string catalog, string sql, bool isStoredProcedure, params SqlParameter[] args) { try { using (Database db = new Database(GetConnectionString(catalog), ProviderName)) { if (isStoredProcedure) { return(db.QuerySP <T>(sql, args)); } return(db.Query <T>(sql, args)); } } catch (SqlException ex) { if (ex.Message.StartsWith("P")) { throw new MixERPException(ex.Message, ex); } throw new MixERPException(ex.Message, ex); } }