Changed section data model

- Made parents nullable
- Added a data key for the tree
- Added depth for quicker layer-wise loading
This commit is contained in:
tsommer committed 2022-07-09 15:03:18 +02:00
1 parent 1ddb6ef1e7
commit c90d3fdd3c
9 files changed
+716 -6

No files matched your search

@@ -35,6 +35,8 @@ public sealed class DataContext : DbContext
modelBuilder.Entity<Section>().HasIndex(n => n.Id);
modelBuilder.Entity<Section>().HasIndex(n => n.Name);
modelBuilder.Entity<Section>().HasIndex(n => n.Depth);
modelBuilder.Entity<Section>().HasIndex(n => n.DataKey);
#endregion
+6 -2
View File
@@ -9,7 +9,11 @@ public sealed class Section
public string Name { get; set; } = string.Empty;
public Section Parent { get; set; }
public string DataKey { get; set; } = string.Empty;
public List<TextElement> TextElements { get; set; }
public int Depth { get; set; } = 0;
public Section? Parent { get; set; }
public List<TextElement> TextElements { get; set; } = new();
}