I have class Plant with some attributes.
public class Plant
{
public int Id { get; set; }
// some attributes
[Display(Name = "Благоприятные соседи")]
public virtual List<Plant> PositivePlants { get; set; }
[Display(Name = "Нежелательные соседи")]
public virtual List<Plant> NegativePlants { get; set; }
public Plant()
{
PositivePlants = new List<Plant>();
NegativePlants = new List<Plant>();
}
}
I hope that EF will create 3 tables in database:
Plants:
Id int PK;
// some another attributes
NegativePlants:
Plant_Id int PK FK;
Negative_Id int PK FK;
PositivePlants:
Plant_Id int PK FK;
Positive_Id int PK FK;enter code here
But by default I get another schema. How I can get following schema using DataAnnotation attributes or Fluent Api?