我对 LINQ 查询有疑问。这里是:
List<a> get = (from i in entitiesFactory.subsDbContext.a
where i.id == id
select i).ToList<a>();
模型是这样的”
public partial class a
{
[Key]
public int id { get; set; }
[ForeignKey("contractors"), Column(Order = 0)]
public Nullable<int> ot_contractor_id { get; set; }
[ForeignKey("contractors1"), Column(Order = 1)]
public Nullable<int> gvo_contractor_id { get; set; }
public virtual contractors contractors { get; set; }
public virtual contractors contractors1 { get; set; }
}
表一个样子:
CREATE TABLE a
(
id serial NOT NULL,
ot_contractor_id integer,
gvo_contractor_id integer,
CONSTRAINT a_pkey PRIMARY KEY (nzp_thgf_det),
CONSTRAINT a_gvo_contractor_id_fkey FOREIGN KEY (gvo_contractor_id)
REFERENCES contractors (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT a_ot_contractor_id_fkey FOREIGN KEY (ot_contractor_id)
REFERENCES contractors (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
)
因此,表“a”有 2 个对其他表“承包商”的引用。
[a].[ot_contractor_id] ---> [contractors].[id]
和
[a].[gvo_contractor_id] ---> [contractors].[id].
问题是:LINQ 查询在尝试执行时下降。
错误:The column Extent1.contractors_id does not exist
。