Unable to set field/property RRS feed

  • Question

  • I have this queries:

    IQueryable<rep> iqREP = dbContext.REP
    .Where(rep => rep.ep.deph == 0
    && rep.RC.TMC.Any(x => x.IDTMC == 84));

    IQueryable<TMC> iqTasks = dbContext.TMC
    .Include(t => t.ED.Select(x => x.D))
    .Include(t => t.MTC.Select(m=>m.Components))  //error when I try select Components
    .Include(t => t.RC)
    .Where(t => t.IDTMC == 84);
    TMCmiTarea = iqTasks.SingleOrDefault();  //error in this line

    I get the error unable to set field/property. If I delete de select(m=>m.Components) it works.

    If I use a raw T-SQL to load in the dbContext the Components in a third query I get the same error, it seems that dbContext can populate the navigation properties.

    I have disabled lazy loading.



    Thursday, May 22, 2014 4:53 PM


All replies

  • Hi ComptonAlvaro,

    Post more information about dbcontext.TMC and related classes.

    Please refer to the following link to see a possible scenario.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 23, 2014 7:25 AM
  • Thanks, I recreate my edmx and the POCO entities and all Works again, really I don't why it could wrong, but the problema was solved.

    Thanks so much.

    Friday, May 23, 2014 2:12 PM