mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16:11:10 +00:00
Formats code comments as sentences in the production sources.
Capitalizes the first word and adds the terminal period across the domain, application, data access, infrastructure, API and web layers and the plugins. No comment is reworded. The change also normalizes the TODO bodies to lowercase, leaves commented-out code untouched, corrects the Threat/Treat typo and the dangling hyphen in the exception middleware, and collapses two accidental repeated terminal periods.
This commit is contained in:
1 parent
88455fec9c
commit
727aa33318
142 files changed
+403
-403
No files matched your search
@@ -142,8 +142,8 @@ public class AlbumConfiguration : IEntityTypeConfiguration<AlbumEntity>
|
||||
.HasForeignKey(album => album.ArtistId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key
|
||||
// Since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key.
|
||||
builder.HasMany(album => album.Tags)
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AlbumContributorConfiguration : IEntityTypeConfiguration<AlbumContr
|
||||
builder.ToTable("AlbumContributors");
|
||||
builder.HasKey(albumContributor => albumContributor.Id);
|
||||
builder.Property(albumContributor => albumContributor.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(albumContributor => albumContributor.AlbumId)
|
||||
@@ -35,7 +35,7 @@ public class AlbumContributorConfiguration : IEntityTypeConfiguration<AlbumContr
|
||||
.IsRequired()
|
||||
.HasColumnOrder(3);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(albumContributor => albumContributor.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(4);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ArtistConfiguration : IEntityTypeConfiguration<ArtistEntity>
|
||||
builder.ToTable("Artists");
|
||||
builder.HasKey(artist => artist.Id);
|
||||
builder.Property(artist => artist.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(artist => artist.LibraryId)
|
||||
@@ -143,8 +143,8 @@ public class ArtistConfiguration : IEntityTypeConfiguration<ArtistEntity>
|
||||
.HasMaxLength(20);
|
||||
});
|
||||
|
||||
// since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key
|
||||
// Since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key.
|
||||
builder.HasMany(artist => artist.Tags)
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ArtistContributorConfiguration : IEntityTypeConfiguration<ArtistCon
|
||||
builder.ToTable("ArtistContributors");
|
||||
builder.HasKey(artistContributor => artistContributor.Id);
|
||||
builder.Property(artistContributor => artistContributor.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(artistContributor => artistContributor.ArtistId)
|
||||
@@ -35,7 +35,7 @@ public class ArtistContributorConfiguration : IEntityTypeConfiguration<ArtistCon
|
||||
.IsRequired()
|
||||
.HasColumnOrder(3);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(artistContributor => artistContributor.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(4);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class BookArtworkConfiguration : IEntityTypeConfiguration<BookArtworkEnti
|
||||
builder.ToTable("BookArtwork");
|
||||
builder.HasKey(bookArtwork => bookArtwork.Id);
|
||||
builder.Property(bookArtwork => bookArtwork.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
builder.Property(bookArtwork => bookArtwork.BookId)
|
||||
.IsRequired()
|
||||
@@ -49,7 +49,7 @@ public class BookArtworkConfiguration : IEntityTypeConfiguration<BookArtworkEnti
|
||||
builder.Property(bookArtwork => bookArtwork.LastUpdateUtc)
|
||||
.HasColumnOrder(8);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(bookArtwork => bookArtwork.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(9);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
builder.ToTable("Books");
|
||||
builder.HasKey(book => book.Id);
|
||||
builder.Property(book => book.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(book => book.Title)
|
||||
@@ -62,8 +62,8 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
.HasColumnOrder(14);
|
||||
builder.Property(book => book.OriginalLanguageNativeName)
|
||||
.HasColumnOrder(15);
|
||||
// since Tag is a Domain ValueObject (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure it as a many-to-many relationship, where the tag itself is the primary key
|
||||
// Since Tag is a Domain ValueObject (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure it as a many-to-many relationship, where the tag itself is the primary key.
|
||||
builder.HasMany(book => book.Tags)
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
@@ -213,7 +213,7 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(book => book.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(32);
|
||||
@@ -231,7 +231,7 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
.HasColumnOrder(35);
|
||||
|
||||
builder.HasIndex(book => new { book.LibraryId, book.Path })
|
||||
.IsUnique(); // the same physical book on disk cannot appear twice in the same library
|
||||
.IsUnique(); // The same physical book on disk cannot appear twice in the same library.
|
||||
builder.HasIndex(book => new { book.LibraryId, book.MetadataStatus });
|
||||
// The deleted items page filters by library and deletion state, and orders by the stored deletion time, the title and the Id, so the
|
||||
// index follows the same order and no temporary B-tree is needed for the sort.
|
||||
|
||||
@@ -20,7 +20,7 @@ public class BookContributorConfiguration : IEntityTypeConfiguration<BookContrib
|
||||
builder.ToTable("BookContributors");
|
||||
builder.HasKey(bookContributor => bookContributor.Id);
|
||||
builder.Property(bookContributor => bookContributor.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(bookContributor => bookContributor.BookId)
|
||||
@@ -35,7 +35,7 @@ public class BookContributorConfiguration : IEntityTypeConfiguration<BookContrib
|
||||
.IsRequired()
|
||||
.HasColumnOrder(3);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(bookContributor => bookContributor.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(4);
|
||||
|
||||
@@ -18,10 +18,10 @@ public class DirectoryScanFingerprintConfiguration : IEntityTypeConfiguration<Di
|
||||
public void Configure(EntityTypeBuilder<DirectoryScanFingerprintEntity> builder)
|
||||
{
|
||||
builder.ToTable("DirectoryScanFingerprints");
|
||||
// composite key, so that each directory scan fingerprint is uniquely identified within its library by its path
|
||||
// Composite key, so that each directory scan fingerprint is uniquely identified within its library by its path.
|
||||
builder.HasKey(directoryScanFingerprint => new { directoryScanFingerprint.LibraryId, directoryScanFingerprint.Path });
|
||||
|
||||
// one library with many directory scan fingerprints
|
||||
// One library with many directory scan fingerprints.
|
||||
builder.HasOne<LibraryEntity>()
|
||||
.WithMany()
|
||||
.HasForeignKey(directoryScanFingerprint => directoryScanFingerprint.LibraryId)
|
||||
@@ -41,7 +41,7 @@ public class DirectoryScanFingerprintConfiguration : IEntityTypeConfiguration<Di
|
||||
.IsRequired()
|
||||
.HasColumnOrder(2);
|
||||
|
||||
// enables fast lookups of the directory scan fingerprints of a library
|
||||
// Enables fast lookups of the directory scan fingerprints of a library.
|
||||
builder.HasIndex(directoryScanFingerprint => directoryScanFingerprint.LibraryId);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class FavoriteConfiguration : IEntityTypeConfiguration<FavoriteEntity>
|
||||
builder.ToTable("Favorites");
|
||||
builder.HasKey(favorite => favorite.Id);
|
||||
builder.Property(favorite => favorite.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
// A favorite belongs to the user that created it, and it is removed with that user.
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ public class LibraryBookReaderConfigurationConfiguration : IEntityTypeConfigurat
|
||||
builder.ToTable("LibraryBookReaderConfigurations");
|
||||
builder.HasKey(configuration => configuration.Id);
|
||||
builder.Property(configuration => configuration.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
builder.Property(configuration => configuration.LibraryId)
|
||||
.IsRequired()
|
||||
@@ -32,7 +32,7 @@ public class LibraryBookReaderConfigurationConfiguration : IEntityTypeConfigurat
|
||||
.IsRequired()
|
||||
.HasColumnOrder(3);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(configuration => configuration.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(4);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
builder.ToTable("Libraries");
|
||||
builder.HasKey(library => library.Id);
|
||||
builder.Property(library => library.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(library => library.Title)
|
||||
@@ -83,19 +83,19 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
.HasDefaultValue(false)
|
||||
.HasColumnOrder(18);
|
||||
|
||||
// one user with many libraries
|
||||
// One user with many libraries.
|
||||
builder.HasOne(library => library.User)
|
||||
.WithMany(user => user.Libraries)
|
||||
.HasForeignKey(library => library.UserId)
|
||||
.IsRequired();
|
||||
|
||||
// one library with many scans
|
||||
// One library with many scans.
|
||||
builder.HasMany(library => library.LibraryScans)
|
||||
.WithOne(libraryScan => libraryScan.Library)
|
||||
.HasForeignKey(libraryScan => libraryScan.LibraryId)
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a library deletes library scans
|
||||
.OnDelete(DeleteBehavior.Cascade); // Deleting a library deletes library scans.
|
||||
|
||||
// using OwnsMany because paths are domain Value Objects, thus they have no independent identity, and their lifecycle is bound to the Library
|
||||
// Using OwnsMany because paths are domain Value Objects, thus they have no independent identity, and their lifecycle is bound to the Library.
|
||||
builder.OwnsMany(library => library.ContentLocations, contentLocationBuilder =>
|
||||
{
|
||||
contentLocationBuilder.ToTable("LibraryContentLocations");
|
||||
@@ -112,7 +112,7 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
// the path template parts are ordered, so their position is stored explicitly and part of a unique index together with the library
|
||||
// The path template parts are ordered, so their position is stored explicitly and part of a unique index together with the library.
|
||||
builder.OwnsMany(library => library.PathTemplateParts, partBuilder =>
|
||||
{
|
||||
partBuilder.ToTable("LibraryPathTemplateParts");
|
||||
@@ -139,7 +139,7 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(library => library.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(12);
|
||||
|
||||
@@ -21,16 +21,16 @@ public class LibraryScanConfiguration : IEntityTypeConfiguration<LibraryScanEnti
|
||||
builder.ToTable("LibraryScans");
|
||||
builder.HasKey(library => library.Id);
|
||||
builder.Property(library => library.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
// one user with many library scans
|
||||
// One user with many library scans.
|
||||
builder.HasOne(libraryScan => libraryScan.User)
|
||||
.WithMany(user => user.LibraryScans)
|
||||
.HasForeignKey(libraryScan => libraryScan.UserId)
|
||||
.IsRequired();
|
||||
|
||||
// one library with many library scans
|
||||
// One library with many library scans.
|
||||
builder.HasOne(libraryScan => libraryScan.Library)
|
||||
.WithMany(library => library.LibraryScans)
|
||||
.HasForeignKey(libraryScan => libraryScan.LibraryId)
|
||||
@@ -41,7 +41,7 @@ public class LibraryScanConfiguration : IEntityTypeConfiguration<LibraryScanEnti
|
||||
.HasConversion<string>()
|
||||
.HasColumnOrder(1);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(libraryScan => libraryScan.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(2);
|
||||
@@ -58,10 +58,10 @@ public class LibraryScanConfiguration : IEntityTypeConfiguration<LibraryScanEnti
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(5);
|
||||
|
||||
// Indexes
|
||||
// Indexes.
|
||||
|
||||
// enables fast lookup of latest non-running scans per library
|
||||
// Enables fast lookup of latest non-running scans per library.
|
||||
builder.HasIndex(libraryScan => new { libraryScan.LibraryId, libraryScan.Status, libraryScan.CreatedOnUtc })
|
||||
.IsDescending(true, false, true); // CreatedOnUtc DESC
|
||||
.IsDescending(true, false, true); // CreatedOnUtc DESC.
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,10 @@ public class LibraryScanResultConfiguration : IEntityTypeConfiguration<LibrarySc
|
||||
public void Configure(EntityTypeBuilder<LibraryScanResultEntity> builder)
|
||||
{
|
||||
builder.ToTable("LibraryScanResults");
|
||||
// composite key for efficient scan-specific lookups (paths are enforced as UNIQUE within the same scan)
|
||||
// Composite key for efficient scan-specific lookups (paths are enforced as UNIQUE within the same scan).
|
||||
builder.HasKey(libraryScanResult => new { libraryScanResult.LibraryScanId, libraryScanResult.Path });
|
||||
|
||||
// one library scan with many library scan results
|
||||
// One library scan with many library scan results.
|
||||
builder.HasOne(libraryScanResult => libraryScanResult.LibraryScan)
|
||||
.WithMany(libraryScan => libraryScan.LibraryScanResults)
|
||||
.HasForeignKey(libraryScanResult => libraryScanResult.LibraryScanId)
|
||||
@@ -38,7 +38,7 @@ public class LibraryScanResultConfiguration : IEntityTypeConfiguration<LibrarySc
|
||||
.HasColumnOrder(1);
|
||||
|
||||
builder.Property(libraryScanResult => libraryScanResult.ContentHash)
|
||||
.HasMaxLength(24) // xxHash128 as Base64
|
||||
.HasMaxLength(24) // xxHash128 as Base64.
|
||||
.IsRequired()
|
||||
.HasColumnOrder(2);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class LibraryScanResultConfiguration : IEntityTypeConfiguration<LibrarySc
|
||||
.HasMaxLength(10)
|
||||
.HasColumnOrder(5);
|
||||
|
||||
// Indexes
|
||||
// Indexes.
|
||||
builder.HasIndex(libraryScanResult => new { libraryScanResult.ContentHash, libraryScanResult.FileSize, libraryScanResult.Path });
|
||||
|
||||
builder.HasIndex(libraryScanResult => libraryScanResult.Path);
|
||||
|
||||
@@ -18,10 +18,10 @@ public class LibraryScanSnapshotConfiguration : IEntityTypeConfiguration<Library
|
||||
public void Configure(EntityTypeBuilder<LibraryScanSnapshotEntity> builder)
|
||||
{
|
||||
builder.ToTable("LibraryScanSnapshots");
|
||||
// composite key, so that each media library scan snapshot item is uniquely identified within its library by its path
|
||||
// Composite key, so that each media library scan snapshot item is uniquely identified within its library by its path.
|
||||
builder.HasKey(libraryScanSnapshot => new { libraryScanSnapshot.LibraryId, libraryScanSnapshot.Path });
|
||||
|
||||
// one library with many media library scan snapshot items
|
||||
// One library with many media library scan snapshot items.
|
||||
builder.HasOne(libraryScanSnapshot => libraryScanSnapshot.Library)
|
||||
.WithMany()
|
||||
.HasForeignKey(libraryScanSnapshot => libraryScanSnapshot.LibraryId)
|
||||
@@ -49,7 +49,7 @@ public class LibraryScanSnapshotConfiguration : IEntityTypeConfiguration<Library
|
||||
.IsRequired()
|
||||
.HasColumnOrder(4);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(libraryScanSnapshot => libraryScanSnapshot.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(5);
|
||||
@@ -66,7 +66,7 @@ public class LibraryScanSnapshotConfiguration : IEntityTypeConfiguration<Library
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(8);
|
||||
|
||||
// enables fast lookups of the media library scan snapshot items of a library
|
||||
// Enables fast lookups of the media library scan snapshot items of a library.
|
||||
builder.HasIndex(libraryScanSnapshot => libraryScanSnapshot.LibraryId);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -18,10 +18,10 @@ public class LibraryScanStagingResultsConfiguration : IEntityTypeConfiguration<L
|
||||
public void Configure(EntityTypeBuilder<LibraryScanStagingResultsEntity> builder)
|
||||
{
|
||||
builder.ToTable("LibraryScanStagingResults");
|
||||
// composite key, so that each media library scan staging result is uniquely identified within its scan by its path
|
||||
// Composite key, so that each media library scan staging result is uniquely identified within its scan by its path.
|
||||
builder.HasKey(libraryScanStagingResult => new { libraryScanStagingResult.LibraryScanId, libraryScanStagingResult.Path });
|
||||
|
||||
// one media library scan with many media library scan staging results
|
||||
// One media library scan with many media library scan staging results.
|
||||
builder.HasOne<LibraryScanEntity>()
|
||||
.WithMany()
|
||||
.HasForeignKey(libraryScanStagingResult => libraryScanStagingResult.LibraryScanId)
|
||||
@@ -61,7 +61,7 @@ public class LibraryScanStagingResultsConfiguration : IEntityTypeConfiguration<L
|
||||
.IsRequired()
|
||||
.HasColumnOrder(7);
|
||||
|
||||
// enables fast lookups of the staging results of a scan that need their content hashed
|
||||
// Enables fast lookups of the staging results of a scan that need their content hashed.
|
||||
builder.HasIndex(libraryScanStagingResult => new { libraryScanStagingResult.LibraryScanId, libraryScanStagingResult.NeedsRehash });
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class MediaConsumptionRecordConfiguration : IEntityTypeConfiguration<Medi
|
||||
builder.ToTable("MediaConsumptionRecords");
|
||||
builder.HasKey(record => record.Id);
|
||||
builder.Property(record => record.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
// A consumption record belongs to the user that started it, and it is removed with that user.
|
||||
|
||||
@@ -20,7 +20,7 @@ public class MediaContributorConfiguration : IEntityTypeConfiguration<MediaContr
|
||||
builder.ToTable("MediaContributors");
|
||||
builder.HasKey(contributor => contributor.Id);
|
||||
builder.Property(contributor => contributor.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
builder.Property(contributor => contributor.DisplayName)
|
||||
.IsRequired()
|
||||
@@ -38,7 +38,7 @@ public class MediaContributorConfiguration : IEntityTypeConfiguration<MediaContr
|
||||
builder.Property(contributor => contributor.DateOfDeath)
|
||||
.HasColumnOrder(5);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(contributor => contributor.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(6);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class MediaResumePointConfiguration : IEntityTypeConfiguration<MediaResum
|
||||
builder.ToTable("MediaResumePoints");
|
||||
builder.HasKey(resumePoint => resumePoint.Id);
|
||||
builder.Property(resumePoint => resumePoint.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
// A resume point belongs to the user that owns it, and it is removed with that user.
|
||||
|
||||
@@ -20,7 +20,7 @@ public class MusicArtworkConfiguration : IEntityTypeConfiguration<MusicArtworkEn
|
||||
builder.ToTable("MusicArtwork");
|
||||
builder.HasKey(musicArtwork => musicArtwork.Id);
|
||||
builder.Property(musicArtwork => musicArtwork.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
builder.Property(musicArtwork => musicArtwork.OwnerType)
|
||||
.IsRequired()
|
||||
@@ -54,7 +54,7 @@ public class MusicArtworkConfiguration : IEntityTypeConfiguration<MusicArtworkEn
|
||||
builder.Property(musicArtwork => musicArtwork.LastUpdateUtc)
|
||||
.HasColumnOrder(9);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(musicArtwork => musicArtwork.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(10);
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ public class MusicLibraryScanItemMetadataConfiguration : IEntityTypeConfiguratio
|
||||
builder.ToTable("MusicLibraryScanItemMetadata");
|
||||
builder.HasKey(musicMetadata => musicMetadata.Id);
|
||||
builder.Property(musicMetadata => musicMetadata.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
builder.Property(musicMetadata => musicMetadata.LibraryScanId)
|
||||
.IsRequired()
|
||||
@@ -103,6 +103,6 @@ public class MusicLibraryScanItemMetadataConfiguration : IEntityTypeConfiguratio
|
||||
.HasColumnOrder(31);
|
||||
|
||||
builder.HasIndex(musicMetadata => new { musicMetadata.LibraryScanId, musicMetadata.Path })
|
||||
.IsUnique(); // the metadata of the same physical file cannot be staged twice during the same scan
|
||||
.IsUnique(); // The metadata of the same physical file cannot be staged twice during the same scan.
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class PermissionConfiguration : IEntityTypeConfiguration<PermissionEntity
|
||||
.HasMaxLength(100)
|
||||
.HasColumnOrder(1);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(permission => permission.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(3);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class PlaylistConfiguration : IEntityTypeConfiguration<PlaylistEntity>
|
||||
builder.ToTable("Playlists");
|
||||
builder.HasKey(playlist => playlist.Id);
|
||||
builder.Property(playlist => playlist.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
// A playlist belongs to the user that created it, and it is removed with that user.
|
||||
|
||||
@@ -20,7 +20,7 @@ public class PluginConfiguration : IEntityTypeConfiguration<PluginEntity>
|
||||
builder.ToTable("Plugins");
|
||||
builder.HasKey(plugin => plugin.Id);
|
||||
builder.Property(plugin => plugin.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
builder.Property(plugin => plugin.Name)
|
||||
.IsRequired()
|
||||
@@ -51,7 +51,7 @@ public class PluginConfiguration : IEntityTypeConfiguration<PluginEntity>
|
||||
.IsRequired()
|
||||
.HasColumnOrder(8);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(plugin => plugin.CreatedBy)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(9);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RoleConfiguration : IEntityTypeConfiguration<RoleEntity>
|
||||
.HasMaxLength(100)
|
||||
.HasColumnOrder(1);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(role => role.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(3);
|
||||
|
||||
@@ -19,26 +19,26 @@ public class RolePermissionConfiguration : IEntityTypeConfiguration<RolePermissi
|
||||
{
|
||||
builder.ToTable("RolePermissions");
|
||||
|
||||
// composite primary key
|
||||
// Composite primary key.
|
||||
builder.HasKey(rolePermission => new { rolePermission.RoleId, rolePermission.PermissionId });
|
||||
|
||||
builder.Ignore(rolePermission => rolePermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id
|
||||
builder.Ignore(rolePermission => rolePermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id.
|
||||
|
||||
// foreign key: Role
|
||||
// Foreign key: Role.
|
||||
builder.HasOne(rolePermission => rolePermission.Role)
|
||||
.WithMany(user => user.RolePermissions)
|
||||
.HasForeignKey(rolePermission => rolePermission.RoleId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a Role deletes associated RolePermission
|
||||
.OnDelete(DeleteBehavior.Cascade); // Deleting a Role deletes associated RolePermission.
|
||||
|
||||
// foreign key: Permission
|
||||
// Foreign key: Permission.
|
||||
builder.HasOne(rolePermission => rolePermission.Permission)
|
||||
.WithMany(role => role.RolePermissions)
|
||||
.HasForeignKey(rolePermission => rolePermission.PermissionId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a Permission deletes associated RolePermission
|
||||
.OnDelete(DeleteBehavior.Cascade); // Deleting a Permission deletes associated RolePermission.
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(rolePermission => rolePermission.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(1);
|
||||
@@ -55,7 +55,7 @@ public class RolePermissionConfiguration : IEntityTypeConfiguration<RolePermissi
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(4);
|
||||
|
||||
// indexes
|
||||
// Indexes.
|
||||
builder.HasIndex(userRole => new { userRole.RoleId, userRole.PermissionId })
|
||||
.IsUnique();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ScheduledJobConfiguration : IEntityTypeConfiguration<ScheduledJobEn
|
||||
builder.ToTable("ScheduledJobs");
|
||||
builder.HasKey(scheduledJob => scheduledJob.Id);
|
||||
builder.Property(scheduledJob => scheduledJob.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(scheduledJob => scheduledJob.Name)
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class SchedulerDisplayPreferencesConfiguration : IEntityTypeConfiguration
|
||||
builder.ToTable("SchedulerDisplayPreferences");
|
||||
builder.HasKey(preferences => preferences.Id);
|
||||
builder.Property(preferences => preferences.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(preferences => preferences.UserId)
|
||||
|
||||
@@ -21,10 +21,10 @@ public class ThemeConfiguration : IEntityTypeConfiguration<ThemeEntity>
|
||||
builder.ToTable("Themes");
|
||||
builder.HasKey(theme => theme.Id);
|
||||
builder.Property(theme => theme.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the install, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the install, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
// the manifest id is the business key used by the clients, so it must be unique
|
||||
// The manifest id is the business key used by the clients, so it must be unique.
|
||||
builder.HasIndex(theme => theme.ThemeId)
|
||||
.IsUnique();
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ThemeConfiguration : IEntityTypeConfiguration<ThemeEntity>
|
||||
.HasConversion<string>()
|
||||
.HasColumnOrder(7);
|
||||
|
||||
// at most one theme can be current: the filtered unique index guarantees it at the database level, since every row that is not current has a null value here, and nulls are allowed to repeat
|
||||
// At most one theme can be current: the filtered unique index guarantees it at the database level, since every row that is not current has a null value here, and nulls are allowed to repeat.
|
||||
builder.HasIndex(theme => theme.IsCurrent)
|
||||
.IsUnique()
|
||||
.HasFilter("IsCurrent = 1");
|
||||
@@ -80,7 +80,7 @@ public class ThemeConfiguration : IEntityTypeConfiguration<ThemeEntity>
|
||||
.IsRequired()
|
||||
.HasColumnOrder(10);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(theme => theme.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(11);
|
||||
|
||||
@@ -167,8 +167,8 @@ public class TrackConfiguration : IEntityTypeConfiguration<TrackEntity>
|
||||
.HasForeignKey(track => track.AlbumId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key
|
||||
// Since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key.
|
||||
builder.HasMany(track => track.Tags)
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
@@ -296,7 +296,7 @@ public class TrackConfiguration : IEntityTypeConfiguration<TrackEntity>
|
||||
|
||||
builder.HasIndex(track => new { track.AlbumId, track.TrackNumber });
|
||||
builder.HasIndex(track => new { track.LibraryId, track.Path })
|
||||
.IsUnique(); // the same physical track file cannot appear twice in the same library
|
||||
.IsUnique(); // The same physical track file cannot appear twice in the same library.
|
||||
// The deleted items page filters by library and deletion state, and orders by the stored deletion time, the title and the Id, so the
|
||||
// filtered index follows the same order and no temporary B-tree is needed for the sort, while visible rows add no entries to it.
|
||||
builder.HasIndex(track => new { track.LibraryId, track.IsDeleted, track.DeletedOnUtc, track.Title, track.Id })
|
||||
|
||||
@@ -20,7 +20,7 @@ public class TrackContributorConfiguration : IEntityTypeConfiguration<TrackContr
|
||||
builder.ToTable("TrackContributors");
|
||||
builder.HasKey(trackContributor => trackContributor.Id);
|
||||
builder.Property(trackContributor => trackContributor.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(trackContributor => trackContributor.TrackId)
|
||||
@@ -35,7 +35,7 @@ public class TrackContributorConfiguration : IEntityTypeConfiguration<TrackContr
|
||||
.IsRequired()
|
||||
.HasColumnOrder(3);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(trackContributor => trackContributor.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(4);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class UserConfiguration : IEntityTypeConfiguration<UserEntity>
|
||||
builder.ToTable("Users");
|
||||
builder.HasKey(user => user.Id);
|
||||
builder.Property(user => user.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(user => user.Username)
|
||||
@@ -45,11 +45,11 @@ public class UserConfiguration : IEntityTypeConfiguration<UserEntity>
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(5);
|
||||
|
||||
// relationships
|
||||
// Relationships.
|
||||
builder.HasMany(user => user.Libraries)
|
||||
.WithOne(library => library.User)
|
||||
.HasForeignKey(library => library.UserId)
|
||||
.IsRequired() // a library must have a user
|
||||
.IsRequired() // A library must have a user.
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(user => user.UserRole)
|
||||
@@ -63,7 +63,7 @@ public class UserConfiguration : IEntityTypeConfiguration<UserEntity>
|
||||
.HasForeignKey(userPermission => userPermission.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(user => user.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(6);
|
||||
@@ -80,8 +80,8 @@ public class UserConfiguration : IEntityTypeConfiguration<UserEntity>
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(9);
|
||||
|
||||
// indexes
|
||||
// Indexes.
|
||||
builder.HasIndex(user => user.Username)
|
||||
.IsUnique(); // queried frequently
|
||||
.IsUnique(); // Queried frequently.
|
||||
}
|
||||
}
|
||||
@@ -19,26 +19,26 @@ public class UserPermissionConfiguration : IEntityTypeConfiguration<UserPermissi
|
||||
{
|
||||
builder.ToTable("UserPermissions");
|
||||
|
||||
// composite primary key
|
||||
// Composite primary key.
|
||||
builder.HasKey(userPermission => new { userPermission.UserId, userPermission.PermissionId });
|
||||
|
||||
builder.Ignore(userPermission => userPermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id
|
||||
builder.Ignore(userPermission => userPermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id.
|
||||
|
||||
// foreign key: User
|
||||
// Foreign key: User.
|
||||
builder.HasOne(userPermission => userPermission.User)
|
||||
.WithMany(user => user.UserPermissions)
|
||||
.HasForeignKey(userPermission => userPermission.UserId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a User deletes associated UserPermissions
|
||||
.OnDelete(DeleteBehavior.Cascade); // Deleting a User deletes associated UserPermissions.
|
||||
|
||||
// foreign key: Permission
|
||||
// Foreign key: Permission.
|
||||
builder.HasOne(userPermission => userPermission.Permission)
|
||||
.WithMany(role => role.UserPermissions)
|
||||
.HasForeignKey(userPermission => userPermission.PermissionId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a Permission deletes associated UserPermissions
|
||||
.OnDelete(DeleteBehavior.Cascade); // Deleting a Permission deletes associated UserPermissions.
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(userPermission => userPermission.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(1);
|
||||
@@ -55,7 +55,7 @@ public class UserPermissionConfiguration : IEntityTypeConfiguration<UserPermissi
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(4);
|
||||
|
||||
// indexes
|
||||
// Indexes.
|
||||
builder.HasIndex(userRole => new { userRole.UserId, userRole.PermissionId })
|
||||
.IsUnique();
|
||||
}
|
||||
|
||||
@@ -19,26 +19,26 @@ public class UserRoleConfiguration : IEntityTypeConfiguration<UserRoleEntity>
|
||||
{
|
||||
builder.ToTable("UserRoles");
|
||||
|
||||
// primary key
|
||||
// Primary key.
|
||||
builder.HasKey(userRole => userRole.UserId );
|
||||
|
||||
builder.Ignore(userRole => userRole.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id
|
||||
builder.Ignore(userRole => userRole.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id.
|
||||
|
||||
// foreign key: User (one-to-one relationship)
|
||||
// Foreign key: User (one-to-one relationship).
|
||||
builder.HasOne(userRole => userRole.User)
|
||||
.WithOne(user => user.UserRole)
|
||||
.HasForeignKey<UserRoleEntity>(userRole => userRole.UserId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a User deletes associated UserRole
|
||||
.OnDelete(DeleteBehavior.Cascade); // Deleting a User deletes associated UserRole.
|
||||
|
||||
// foreign key: Role (many-to-one relationship)
|
||||
// Foreign key: Role (many-to-one relationship).
|
||||
builder.HasOne(userRole => userRole.Role)
|
||||
.WithMany(role => role.UserRoles)
|
||||
.HasForeignKey(userRole => userRole.RoleId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a Role deletes associated UserRoles
|
||||
.OnDelete(DeleteBehavior.Cascade); // Deleting a Role deletes associated UserRoles.
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(userRole => userRole.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(1);
|
||||
@@ -55,7 +55,7 @@ public class UserRoleConfiguration : IEntityTypeConfiguration<UserRoleEntity>
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(4);
|
||||
|
||||
// indexes
|
||||
// Indexes.
|
||||
builder.HasIndex(userRole => new { userRole.UserId, userRole.RoleId })
|
||||
.IsUnique();
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration<UserSettingsEn
|
||||
builder.ToTable("UserSettings");
|
||||
builder.HasKey(settings => settings.Id);
|
||||
builder.Property(settings => settings.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it.
|
||||
.HasColumnOrder(0);
|
||||
|
||||
// one user with one set of settings
|
||||
// One user with one set of settings.
|
||||
builder.HasOne<UserEntity>()
|
||||
.WithOne()
|
||||
.HasForeignKey<UserSettingsEntity>(settings => settings.UserId)
|
||||
@@ -130,7 +130,7 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration<UserSettingsEn
|
||||
.IsRequired()
|
||||
.HasColumnOrder(29);
|
||||
|
||||
// audit
|
||||
// Audit.
|
||||
builder.Property(settings => settings.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(5);
|
||||
@@ -147,7 +147,7 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration<UserSettingsEn
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(8);
|
||||
|
||||
// one user can have at most one set of settings
|
||||
// One user can have at most one set of settings.
|
||||
builder.HasIndex(settings => settings.UserId)
|
||||
.IsUnique();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Reflection;
|
||||
namespace Lumina.DataAccess.Common.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Utility class for registering the services of the Data Access layer into the Dependency Injection container..
|
||||
/// Utility class for registering the services of the Data Access layer into the Dependency Injection container.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public static class DataAccessLayerServices
|
||||
|
||||
@@ -68,7 +68,7 @@ public sealed class UpdateAuditableEntitiesInterceptor : SaveChangesInterceptor
|
||||
Guid? userId = _currentUserService.UserId;
|
||||
DateTime utcNow = _dateTimeProvider.UtcNow;
|
||||
|
||||
// retrieve all entities implementing IAuditableEntity that are being tracked and have either Added or Modified state
|
||||
// Retrieve all entities implementing IAuditableEntity that are being tracked and have either Added or Modified state.
|
||||
foreach (EntityEntry<IAuditableEntity> entry in context.ChangeTracker.Entries<IAuditableEntity>())
|
||||
{
|
||||
if (entry.State == EntityState.Added)
|
||||
@@ -100,12 +100,12 @@ public sealed class UpdateAuditableEntitiesInterceptor : SaveChangesInterceptor
|
||||
/// <param name="utcNow">The current UTC timestamp.</param>
|
||||
private static void SetModificationProperties(EntityEntry<IAuditableEntity> entry, Guid? userId, DateTime utcNow)
|
||||
{
|
||||
// prevent modification of creation properties
|
||||
// Prevent modification of creation properties.
|
||||
entry.Property(auditableEntity => auditableEntity.CreatedOnUtc).IsModified = false;
|
||||
entry.Property(auditableEntity => auditableEntity.CreatedBy).IsModified = false;
|
||||
|
||||
// set modification properties
|
||||
// Set modification properties.
|
||||
entry.Entity.UpdatedOnUtc = utcNow;
|
||||
entry.Entity.UpdatedBy = userId ?? Guid.Parse("11111111-1111-1111-1111-111111111111"); // "SYSTEM" user Id
|
||||
entry.Entity.UpdatedBy = userId ?? Guid.Parse("11111111-1111-1111-1111-111111111111"); // "SYSTEM" user Id.
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -98,8 +98,8 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
// backfill the artwork of the books that already had a cover, so that the stored covers are preserved as enriched cover artwork
|
||||
// before the CoverImagePath column is dropped
|
||||
// Backfill the artwork of the books that already had a cover, so that the stored covers are preserved as enriched cover artwork
|
||||
// before the CoverImagePath column is dropped.
|
||||
migrationBuilder.Sql("""
|
||||
INSERT INTO BookArtwork (Id, BookId, ArtworkType, Ordinal, FileName, ContentHash, Status, Provider, LastUpdateUtc, CreatedOnUtc, CreatedBy, UpdatedOnUtc, UpdatedBy)
|
||||
SELECT lower(hex(randomblob(16))), Id, 'Cover', 0, CoverImagePath, 0, 'Enriched', NULL, NULL, datetime('now'), '00000000-0000-0000-0000-000000000000', NULL, NULL
|
||||
|
||||
Reference in new issue
Block a user