I have a problem with LINQ query. Here this:
List<a> get = (from i in entitiesFactory.subsDbContext.a
where i.id == id
select i).ToList<a>();
The model look like this"
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; }
}
Table a look like this:
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,
)
So, table 'a' have 2 references to other table 'contractors'.
[a].[ot_contractor_id] ---> [contractors].[id]
and
[a].[gvo_contractor_id] ---> [contractors].[id].
The problem is: LINQ query has fallen when it try to execute.
ERROR: The column Extent1.contractors_id does not exist.