diff options
| author | transtrike <transtrike@gmail.com> | 2021-04-07 18:41:30 +0300 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-04-07 18:41:30 +0300 |
| commit | b8d1edfc582bee2ef648757bcad1bbadd075bb08 (patch) | |
| tree | 0042a44c3091af36994cdc9b91a835ed1d803eaa /src/Data/DevHive.Data/DevHiveContext.cs | |
| parent | f4eac9c89bef0c21d7ccb29cb0841fa621c79f46 (diff) | |
| parent | da7d6223c261aac8e8f18458c11fb48cf9ca4cfe (diff) | |
| download | DevHive-b8d1edfc582bee2ef648757bcad1bbadd075bb08.tar DevHive-b8d1edfc582bee2ef648757bcad1bbadd075bb08.tar.gz DevHive-b8d1edfc582bee2ef648757bcad1bbadd075bb08.zip | |
Merged from dev
Diffstat (limited to 'src/Data/DevHive.Data/DevHiveContext.cs')
| -rw-r--r-- | src/Data/DevHive.Data/DevHiveContext.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Data/DevHive.Data/DevHiveContext.cs b/src/Data/DevHive.Data/DevHiveContext.cs index 621336f..0606864 100644 --- a/src/Data/DevHive.Data/DevHiveContext.cs +++ b/src/Data/DevHive.Data/DevHiveContext.cs @@ -17,6 +17,7 @@ namespace DevHive.Data public DbSet<PostAttachments> PostAttachments { get; set; } public DbSet<Comment> Comments { get; set; } public DbSet<Rating> Rating { get; set; } + public DbSet<ProfilePicture> ProfilePicture { get; set; } protected override void OnModelCreating(ModelBuilder builder) { @@ -25,11 +26,6 @@ namespace DevHive.Data .HasIndex(x => x.UserName) .IsUnique(); - builder.Entity<User>() - .HasOne(x => x.ProfilePicture) - .WithOne(x => x.User) - .HasForeignKey<ProfilePicture>(x => x.UserId); - /* Roles */ builder.Entity<User>() .HasMany(x => x.Roles) @@ -92,6 +88,15 @@ namespace DevHive.Data .HasMany(x => x.Ratings) .WithOne(x => x.Post); + /* Profile Picture */ + builder.Entity<ProfilePicture>() + .HasKey(x => x.Id); + + builder.Entity<User>() + .HasOne(x => x.ProfilePicture) + .WithOne(x => x.User) + .HasForeignKey<ProfilePicture>(x => x.UserId); + base.OnModelCreating(builder); } } |
