diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs index c56ef7a93..36e7289eb 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs @@ -30,14 +30,21 @@ namespace SqlSugar if (dataReader == null) return result; while (dataReader.Read()) { - result.Add(entytyList.Build(dataReader)); + try + { + result.Add(entytyList.Build(dataReader)); + } + catch (Exception ex) + { + Check.Exception(true, ErrorMessage.EntityMappingError, ex.Message); + } SetAppendColumns(dataReader); } ExecuteDataAfterFun(context, dataAfterFunc, result); } - catch (Exception ex) + catch { - Check.Exception(true, ErrorMessage.EntityMappingError, ex.Message); + throw; } return result; } @@ -60,14 +67,21 @@ namespace SqlSugar if (dataReader == null) return result; while (await((DbDataReader)dataReader).ReadAsync()) { - result.Add(entytyList.Build(dataReader)); + try + { + result.Add(entytyList.Build(dataReader)); + } + catch (Exception ex) + { + Check.Exception(true, ErrorMessage.EntityMappingError, ex.Message); + } SetAppendColumns(dataReader); } ExecuteDataAfterFun(context, dataAfterFunc, result); } - catch (Exception ex) + catch { - Check.Exception(true, ErrorMessage.EntityMappingError, ex.Message); + throw; } return result; }