سلام
میخواستم در کلاس زیر هر 3 پراپرتی(Sen_Id,Rec1_Id,Rev2_Id) رو به ApplicationUser.Id متصل کنم که هر 3 هر کدام برای خودشان از Id از جدول ApplicationUser مقدار بگیرند (یرای هر کدام یک کاربر ثبت بشه)ولی ارور زیر رو نشون میده
اصلا راه رو درست رفتم ؟؟
Table.cs
[Key] public int Relation_Id { get; set; } [Key, ForeignKey("ApplicationUser")] public ApplicationUser ApplicationUser_Sender { get; set; } public int Sen_Id { get; set; } [Key, ForeignKey("ApplicationUser")] public ApplicationUser ApplicationUser_Rec1 { get; set; } public string Rec1_Id { get; set; } [Key, ForeignKey("ApplicationUser")] public ApplicationUser ApplicationUser_Rec2 { get; set; } public string Rec2_Id { get; set; }
ApplicationUser.cs
public class ApplicationUser : IdentityUser { public virtual ICollection<Relation> Relation { get; set; } }
ApplicationDbContext
builder.Entity<Relation>() .HasKey(c => new { c.Relation_Id, c.Sen_Id,c.Rec1_Id,c.Rec2_Id});
Error
Unable to determine the relationship represented by navigation property 'ApplicationUser.Relation' of type 'ICollection<Relation>'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
اصلا منظورتون رو متوجه نشدم
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)