From 33a3c4d57d774d98c3836c98ecbd2e1dd5ea84c3 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Wed, 6 Sep 2023 02:46:10 +1000 Subject: Added pointer to current UploadedFile on Media --- HBContext.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'HBContext.cs') 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() .HasMany(e => e.ImplicitTags) .WithMany(); + + modelBuilder.Entity() + .HasOne(m => m.CurrentUploadedFile) + .WithOne() + .HasForeignKey("CurrentUploadedFileId"); } } \ No newline at end of file -- cgit v1.3