Linq To Entities 'Only primitive types or enumeration types are supported' Error

后端 未结 4 2086
梦如初夏
梦如初夏 2020-12-01 22:03

I am using LinqPad to test my query. This query works when the LInqPad connection is to my database (LInq to SQL) but it does not work when I change the connection to use my

4条回答
  •  醉话见心
    2020-12-01 22:32

    If the relationship already exists.

    Why not simply say.

    var q = from pd in PlanDetails
            select new {
                pd.PlanDetailID,
                ThePlanName = pd.Plan.PlanName
            };
    

    Of course i'm assuming that every PlanDetail will belong to a Plan.

    Update

    To get better results from LinqPad you could tell it to use your own assembly (which contains your DbContext) instead of the default Datacontext it uses.

提交回复
热议问题