#58 added owned entity for SocialNetworks that belongs to an ApplicationUser

This commit is contained in:
Dominic Villemure
2024-06-11 20:14:36 -04:00
parent aca7939e8d
commit 47fb3caa0d
8 changed files with 643 additions and 22 deletions

View File

@@ -0,0 +1,16 @@
using Hutopy.Infrastructure.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Hutopy.Infrastructure.Data.Configurations;
public class ApplicationUserConfiguration : IEntityTypeConfiguration<ApplicationUser>
{
public void Configure(EntityTypeBuilder<ApplicationUser> builder)
{
// Relationship between ApplicationUser and SocialNetworks
builder
.OwnsOne(u => u.SocialNetworks)
.ToTable($"{nameof(ApplicationUser)}_SocialNetworks");
}
}