diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-09-06 02:46:10 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2025-08-20 00:51:51 +1000 |
| commit | 6ed8b2f7a2bac84f582048181c58cc318b729322 (patch) | |
| tree | 176d3342b51794d4235ae70e47f47d093db0de5e /HBContext.cs | |
| parent | 0d12ecef127c2724e168c220f9d6b934090a4290 (diff) | |
Added pointer to current UploadedFile on Media
Diffstat (limited to 'HBContext.cs')
| -rw-r--r-- | HBContext.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/HBContext.cs b/HBContext.cs index 15dad6d..415b745 100644 --- a/HBContext.cs +++ b/HBContext.cs @@ -55,10 +55,15 @@ public class HBContext : DbContext { } }); - // Implicit tags need some special attention to make many<->many - // navigations work for the same object type. + // Some complex relationships cannot be inferred and require + // additional configuration, as seen below. modelBuilder.Entity<TagDefinition>() .HasMany(e => e.ImplicitTags) .WithMany(); + + modelBuilder.Entity<Media>() + .HasOne(m => m.CurrentUploadedFile) + .WithOne() + .HasForeignKey<Media>("CurrentUploadedFileId"); } }
\ No newline at end of file |
