-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConcoctbuilderDbContext.cs
106 lines (84 loc) · 3.6 KB
/
ConcoctbuilderDbContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
#nullable disable
namespace Concoct_Builder
{
public partial class ConcoctbuilderDbContext : DbContext
{
public ConcoctbuilderDbContext()
{
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlite("Data Source=ConcoctBuilder.db");
}
}
public ConcoctbuilderDbContext(DbContextOptions<ConcoctbuilderDbContext> options)
: base(options)
{
}
public virtual DbSet<AssociatedTags> AssociatedTags { get; set; }
public virtual DbSet<LayoutData> LayoutData { get; set; }
public virtual DbSet<Layouts> Layouts { get; set; }
public virtual DbSet<Projects> Projects { get; set; }
public virtual DbSet<Tags> Tags { get; set; }
public virtual DbSet<UserSettings> UserSettings { get; set; }
public virtual DbSet<WorkItems> WorkItems { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<AssociatedTags>(entity =>
{
entity.HasOne(d => d.Layout)
.WithMany(p => p.AssociatedTags)
.HasForeignKey(d => d.LayoutId);
entity.HasOne(d => d.Project)
.WithMany(p => p.AssociatedTags)
.HasForeignKey(d => d.ProjectId);
entity.HasOne(d => d.Tag)
.WithMany(p => p.AssociatedTags)
.HasForeignKey(d => d.TagId);
});
modelBuilder.Entity<LayoutData>(entity =>
{
entity.Property(e => e.HPercent).HasColumnName("hPercent");
entity.Property(e => e.HoPercent).HasColumnName("hoPercent");
entity.Property(e => e.WPercent).HasColumnName("wPercent");
entity.Property(e => e.WoPercent).HasColumnName("woPercent");
entity.HasOne(d => d.Layout)
.WithMany(p => p.LayoutDataLayout)
.HasForeignKey(d => d.LayoutId);
entity.HasOne(d => d.RefereenceScreenNavigation)
.WithMany(p => p.LayoutDataRefereenceScreenNavigation)
.HasForeignKey(d => d.RefereenceScreen);
});
modelBuilder.Entity<Layouts>(entity =>
{
entity.HasOne(d => d.Project)
.WithMany(p => p.Layouts)
.HasForeignKey(d => d.ProjectId);
entity.HasOne(d => d.UserSettingNavigation)
.WithMany(p => p.Layouts)
.HasForeignKey(d => d.UserSetting);
entity.HasOne(d => d.WorkItem)
.WithMany(p => p.Layouts)
.HasForeignKey(d => d.WorkItemId);
});
modelBuilder.Entity<Tags>(entity =>
{
entity.Property(e => e.IsNew).HasDefaultValueSql("0");
});
modelBuilder.Entity<UserSettings>(entity =>
{
entity.Property(e => e.Id).ValueGeneratedNever();
entity.Property(e => e.OrganizationName).IsRequired();
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
}