Linq2Sql Many:Many question, How would you do this?

后端 未结 1 1379
失恋的感觉
失恋的感觉 2021-02-03 13:58

I know many:many isn\'t supported in Linq2Sql but I am working on a workaround

I am working with my little SO clone and I have a table with Questions and a table with Ta

1条回答
  •  灰色年华
    2021-02-03 14:42

    This may work for your case;

    from q in Questions
    select new ListQuestion 
    { 
      Tags = q.QuestionTags.Select(qt => qt.Tag),
      QuestionId = q.ID,
      Title = q.Title
    }
    

    0 讨论(0)
提交回复
热议问题