From 2b5de0aa1ea8bc42edf78201bc4154f404478942 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Wed, 13 Jul 2022 20:04:26 +0200 Subject: [PATCH] Auto included must navigation properties in data model --- I18N Commander/DataModel/Database/Common/DataContext.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/I18N Commander/DataModel/Database/Common/DataContext.cs b/I18N Commander/DataModel/Database/Common/DataContext.cs index eee9081..f7b0b7c 100644 --- a/I18N Commander/DataModel/Database/Common/DataContext.cs +++ b/I18N Commander/DataModel/Database/Common/DataContext.cs @@ -37,6 +37,8 @@ public sealed class DataContext : DbContext modelBuilder.Entity
().HasIndex(n => n.Name); modelBuilder.Entity
().HasIndex(n => n.Depth); modelBuilder.Entity
().HasIndex(n => n.DataKey); + // modelBuilder.Entity
().Navigation(n => n.Parent).AutoInclude(); // Cyclic reference, does not work, though. + modelBuilder.Entity
().Navigation(n => n.TextElements).AutoInclude(); #endregion @@ -45,6 +47,7 @@ public sealed class DataContext : DbContext modelBuilder.Entity().HasIndex(n => n.Id); modelBuilder.Entity().HasIndex(n => n.Code); modelBuilder.Entity().HasIndex(n => n.Name); + modelBuilder.Entity().Navigation(n => n.Section).AutoInclude(); #endregion @@ -53,6 +56,7 @@ public sealed class DataContext : DbContext modelBuilder.Entity().HasIndex(n => n.Id); modelBuilder.Entity().HasIndex(n => n.Culture); modelBuilder.Entity().HasIndex(n => n.Text); + modelBuilder.Entity().Navigation(n => n.TextElement).AutoInclude(); #endregion }