I'm trying to generate a model for and AspnetUser that has one-to-many relationships with Followers and Followees. The Following Class is defines as:
public class Following
{
[Key]
[Column(Order = 1)]
public string FollowerId { get; set; }
[Key]
[Column(Order = 2)]
public string FolloweeId { get; set; }
public ApplicationUser Follower { get; set; }
public ApplicationUser Followee { get; set; }
}
The following worked in EntityFramework but not in EntityFramework Core.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<ApplicationUser>()
.HasMany(u => u.Followers)
.WithRequired(f => f.Followee)
.WillCascadeOnDelete(false);
modelBuilder.Entity<ApplicationUser>()
.HasMany(u => u.Followees)
.WithRequired(f => f.Follower)
.WillCascadeOnDelete(false);
base.OnModelCreating(modelBuilder);
}
Any help figuring this out greatly appreciated.