使用ApplicationUser的多對多EF核心

entity-framework entity-framework-core

我正在嘗試在ApplicationUser和Reserve之間創建多對多關係。

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多對多嗎?

一般承認的答案

我在ef核心中找到了以下內容:尚不支持沒有實體類來表示連接表的多對多關係。所以我的問題已經結束了。



Related

許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow