2016-08-13 14 views
-1

ApplicationUserとReserveの間に多対多の関係を作成しようとしています。ApplicationUserを使用する多対多EFコア

public class ApplicationUser : IdentityUser 
{ 
    public ApplicationUser() 
    { 
     this.Reserves = new HashSet<Reserve>(); 
    } 
    public bool IsProfessional { get; set; } 

    public virtual ICollection<Reserve> Reserves { get; set; } 
} 

public class Reserve 
{ 

    public Reserve() 
    { 
     this.Usuarios = new HashSet<ApplicationUser>(); 
    } 
    public int ID { get; set; } 
    public string Begin { get; set; } 
    public string End { get; set; } 
    public string Date { get; set; } 
    public string Status { get; set; } //free , reserved, confirmed, canceled 
    public DateTime LastUpdate { get; set; } 

    public virtual ICollection<ApplicationUser> Usuarios { get; set; } 
} 

しかし、私はとにかく移行

PM> Add-Migration user-reserve-relationship 
Unable to determine the relationship represented by navigation property 'ApplicationUser.Reserves' of type 'ICollection<Reserve>'. Either manually configure the relationship, or ignore this property from the model. 

を追加カント、同じ関係が他のエンティティではなくApplicationUserに適しています。

ApplicationUser many-to-manyを使用できますか?

答えて

1

次のefコアが見つかりました: ジョインテーブルを表すエンティティクラスのない多対多の関係はまだサポートされていません。 私の質問は閉鎖されています。

関連する問題