mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-05-09 16:16:13 -04:00
Log initial db state, esp to capture books in trash
This commit is contained in:
@@ -16,6 +16,10 @@ public static class BookQueries
|
||||
.AsNoTrackingWithIdentityResolution()
|
||||
.GetBook(productId);
|
||||
|
||||
/// <summary>Total rows in <see cref="LibationContext.Books"/> (no related entities loaded).</summary>
|
||||
public static int GetBookCount(this LibationContext context)
|
||||
=> context.Books.AsNoTracking().Count();
|
||||
|
||||
public static Book? GetBook(this IQueryable<Book> books, string productId)
|
||||
=> books
|
||||
.GetBooks()
|
||||
|
||||
@@ -62,6 +62,13 @@ public static class LibraryBookQueries
|
||||
.Where(lb => lb.IsDeleted || lb.Book.ContentType == ContentType.Parent)
|
||||
.getLibrary()
|
||||
.ToList();
|
||||
|
||||
/// <summary>Counts <see cref="LibraryBook"/> rows by <see cref="LibraryBook.IsDeleted"/> (no related entities loaded).</summary>
|
||||
public (int NotInTrash, int InTrash) GetLibraryBookCountsByTrashFlag()
|
||||
{
|
||||
var q = context.LibraryBooks.AsNoTracking();
|
||||
return (q.Count(lb => !lb.IsDeleted), q.Count(lb => lb.IsDeleted));
|
||||
}
|
||||
}
|
||||
|
||||
extension(IQueryable<LibraryBook> library)
|
||||
|
||||
Reference in New Issue
Block a user