Many-to-Many EF core with ApplicationUser

entity-framework entity-framework-core

Question

I am trying to create a many-to-many relationship between ApplicationUser and 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; }
}

But I cant add the migration

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. 

Anyway, the same relationship works well to others entities but not ApplicationUser.

Can I use ApplicationUser many-to-many?

1
-1
8/13/2016 7:54:28 PM

Accepted Answer

I found the follow in ef core : Many-to-many relationships without an entity class to represent the join table are not yet supported. So my question is closed.

1
8/13/2016 8:36:22 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow