summaryrefslogtreecommitdiff
path: root/HBContext.cs
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-09-06 02:46:10 +1000
committerJake Mannens <jake@asger.xyz>2023-09-06 02:46:10 +1000
commit33a3c4d57d774d98c3836c98ecbd2e1dd5ea84c3 (patch)
tree56635cc50f542e3bf06521f24e6c240ec1d68d5a /HBContext.cs
parent422a3de38ad473a7aec19c854038a3b2ecf16f1c (diff)
Added pointer to current UploadedFile on Media
Diffstat (limited to 'HBContext.cs')
-rw-r--r--HBContext.cs9
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