private FileStorageFolder GetCapsuleContentFolder(FileStorageDataContext db)
{
IQueryable<FileStorageFolder> source = from dbFolder in db.FileStorageFolders
where (dbFolder.ParentID == null) && (dbFolder.Purpose == reportFolderPurpose)
select dbFolder into dbFolder
join dbSubFolder in db.FileStorageFolders on dbFolder.ID equals
dbSubFolder.ParentID into dbSubFolder
where (dbSubFolder.Purpose == capsulelayoutFolderPurpose) &&
(dbSubFolder.FolderName == capsuleReportContent)
select dbSubFolder;
Instrument.Assert(source.Count<FileStorageFolder>() == 1);
return source.Single<FileStorageFolder>();
}
这是不正确的语法。有谁知道如何在此基础上创建IQueryable类型?
答案 0 :(得分:0)
如果有问题,请尝试将“优化”设置放到.NET 2.0上。然后将强制显示显式.Select(...)
等。这应该产生正确的C#,但没有LINQ样式。
但请注意,它也可能会反转明显的调用顺序,因为它可能会使用显式扩展方法表示。不过,代码应该是等效的。