0

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.

3
  • Well what does the table look like? Commented Jul 16, 2013 at 5:44
  • I just added, please, look. Commented Jul 16, 2013 at 6:03
  • SOLVED! You can see answer on stackoverflow.com/questions/17743172/… Commented Jul 22, 2013 at 11:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.