来自TABLE的Linq选择*

时间:2011-07-07 09:26:43

标签: c# .net asp.net linq linq-to-sql

我需要从表格中选择所有字段,我尝试使用以下代码进行操作,然后我得到错误通知类名称此时无效

from item in context.CreateQuery<permitdocumentfields>()
where item.Id == new Guid(Request["view"])
select new 
       { permitdocumentfields }

如何使这些内容像FROM TABLE SELECT *一样工作?

1 个答案:

答案 0 :(得分:10)

from item in context.CreateQuery<permitdocumentfields>()
where item.Id == new Guid(Request["view"])
select item 

查看帖子了解更多详情:SQL to LINQ ( Visual Representation )

简单选择 enter image description here

选择过滤器并选择新 enter image description here

注意:当您只想构建新对象时,需要select new