我在我的项目中使用委托反编译器。 https://github.com/hazzik/DelegateDecompiler
实体模型(部分):
public long Id { get; set; }
public long ItemId { get; set; }
public long InfoItemId { get; set; }
[Computed]
public bool IsInfo
{
get
{
return (InfoItemId > 0 && ItemId == 0) ? true : false;
}
}
AttachmentModel:
private class AttachmentModel
{
public string OriginalFileName { get; set; }
public string ItemFileType { get; set; }
public string Thumbnail { get; set; }
public string File { get; set; }
public string Category { get; set; }
public bool IsInfo { get; set; }
}
查询(部分):
Attachments = (from attachments in db.Attachments
where attachments.ItemId == i.Id || attachments.InfoItemId == infoId
select new AttachmentModel
{
OriginalFileName = attachments.ItemOriginalFileName,
ItemFileType = attachments.ItemFileType,
Thumbnail = attachments.FileThumbnailRelative,
File = attachments.FileUrlRelative,
Category = attachments.ItemFileCategory,
IsInfo = attachments.IsInfo.Computed()
}).ToList()
但是我得到一个错误:
LINQ to Entities无法识别方法'Boolean ComputedBoolean'方法,并且该方法不能为 转换为商店表达式。
问:在这种情况下可以使用委托反编译器吗?怎么样? 请提供一些示例。