Skip to content

Commit

Permalink
Refactor the containing loop to do more than one iteration.
Browse files Browse the repository at this point in the history
  • Loading branch information
maikebing committed Sep 18, 2022
1 parent df283c7 commit 5966fd3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions IoTSharp.Extensions.EFCore/DbReaderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ public static async Task<T> FirstOrDefaultAsync<T>(this DbDataReader dr)
while (await dr.ReadAsync())
{
result= dr.MapObject<T>(colMapping);
break;
if (result != null)
{
break;
}
}
}
dr.Close();
Expand All @@ -274,7 +277,10 @@ public static T FirstOrDefault<T>(this DbDataReader dr)
while ( dr.Read())
{
result = dr.MapObject<T>(colMapping);
break;
if (result != null)
{
break;
}
}
}
dr.Close();
Expand Down

0 comments on commit 5966fd3

Please sign in to comment.