diff --git a/IoTSharp.Extensions.EFCore/DbReaderExtensions.cs b/IoTSharp.Extensions.EFCore/DbReaderExtensions.cs index 8f6f6e5b1..d76427aa3 100644 --- a/IoTSharp.Extensions.EFCore/DbReaderExtensions.cs +++ b/IoTSharp.Extensions.EFCore/DbReaderExtensions.cs @@ -256,7 +256,10 @@ public static async Task FirstOrDefaultAsync(this DbDataReader dr) while (await dr.ReadAsync()) { result= dr.MapObject(colMapping); - break; + if (result != null) + { + break; + } } } dr.Close(); @@ -274,7 +277,10 @@ public static T FirstOrDefault(this DbDataReader dr) while ( dr.Read()) { result = dr.MapObject(colMapping); - break; + if (result != null) + { + break; + } } } dr.Close();