Null safety and minor UI bugfix

Properly cancel the Locate Audiobooks when the dialog window closes before scanning is finished.
This commit is contained in:
Michael Bucari-Tovo
2025-08-04 17:15:37 -06:00
parent 29be091a4b
commit db588629c0
7 changed files with 55 additions and 42 deletions

View File

@@ -2,6 +2,7 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
#nullable enable
namespace DataLayer
{
// only library importing should use tracking. All else should be NoTracking.
@@ -24,13 +25,13 @@ namespace DataLayer
.Where(c => !c.Book.IsEpisodeParent() || includeParents)
.ToList();
public static LibraryBook GetLibraryBook_Flat_NoTracking(this LibationContext context, string productId)
public static LibraryBook? GetLibraryBook_Flat_NoTracking(this LibationContext context, string productId)
=> context
.LibraryBooks
.AsNoTrackingWithIdentityResolution()
.GetLibraryBook(productId);
public static LibraryBook GetLibraryBook(this IQueryable<LibraryBook> library, string productId)
public static LibraryBook? GetLibraryBook(this IQueryable<LibraryBook> library, string productId)
=> library
.GetLibrary()
.SingleOrDefault(lb => lb.Book.AudibleProductId == productId);