简体   繁体   中英

EFCore can't understand many to many

I get the following error: Unable to determine the relationship represented by navigation property 'Application.Computers' of type 'ICollection'. Either manually configure the relationship, or ignore this property from the model.
My code for Computer.cs

public int Id { get; private set; }
/* some properties */
public ICollection<Application> Applications { get; set; }

And Application.cs

public int Id { get; private set; }
/* some properties */
public ICollection<Computer> Computers { get; set; }

I'm new to EF and EFCore, so I don't know if this is the way to make many to many relationships. If so, what am I doing wrong? Else how can I manually configure the relationship?

Documentation says it all: Many-to-many relationships without an entity class to represent the join table are not yet supported .
However, you can represent a many-to-many relationship by including an entity class for the join table and mapping two separate one-to-many relationships.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM