保存 Linq 查询并在从逻辑删除恢复时使用
我有一个包含 500 个要查询的对象的 List
。在进行逻辑删除时,我不想将这 500 个对象保存到 State,而是想保存查询本身,以便在返回时,我可以将其插入到显示 500 个对象的查询的类中。
因此,如果我有 Dim pictures = (From s In p.AllPicturesWhere s.IsFavorite = True Order By s.Index Ascending).ToList,我怎样才能将查询本身保存到 State 以便从逻辑删除返回后我可以将该查询分配给图片
?
I have a List
of 500 objects that are queried against. When tombstoning, rather than save those 500 object to State
, I'm wanting to save the query itself so that upon returning, I can just plug that into my class that shows the query of the 500 objects.
So if I have Dim pictures = (From s In p.AllPictures Where s.IsFavorite = True Order By s.Index Ascending).ToList
, how can I save just the query itself to State
so that upon returning from tombstoning I can assign that query to pictures
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法保存查询,因为查询是代码而不是数据。您可能的意思是分配查询的结果?
只需将
pictures
变量保存到State
而不是p.AllPictures
即可。You can't save a query per say, as the query is code and not data. You probably mean to assign the result of the query?
Simply save your
pictures
variable to theState
rather than thep.AllPictures
.