1
我已經有了下面的表格。首先在EF核心1.0上的多對多關係首先與模型?
create table A (Id char(8) primary key, .....)
create table B (Id int primary key, .....)
create table A_B (AId references A(Id), BId references B(Id), primarykey(AId, BId))
什麼是爲這些多對多關係定義類的最佳方式是什麼?
class A {
public string Id { get; set; }
....
public List<B> Bs { get; set; } or List<A_B> A_Bs?
}
class B {
public int Id { get; set; }
....
public List<A> As { get; set; } or List<A_B> A_Bs?
}
class A_B ???
https://docs.efproject.net/en/latest/modeling /relationships.html#many-to-many –