Entity framework - “Problem in mapping fragments”-error. Help me understand the explanations of this error

后端 未结 12 1784
不知归路
不知归路 2020-12-15 02:49

Error 3007: Problem in Mapping Fragments starting at lines 186, 205: Non-Primary-Key column(s) [WheelID] are being mapped

12条回答
  •  一生所求
    2020-12-15 03:29

    For LinQ to Entities queries in EF1, my workaround for not having access to the foreign key as a property is with the following code, which does not produce a join query to the associated table:

    dbContext.Table1s.FirstOrDefault(c => (int?)c.Table2.Id == null)
    

    i.e, the generated SQL is:

    ...WHERE ([Extent1].[Table2Id] IS NULL)...
    

提交回复
热议问题