使用LINQ / Entity Framework选择除一个属性之外的所有属性 [英] Selecting all but one property using LINQ/Entity Framework
问题描述
我正在使用实体框架作为项目的一部分,应允许学生和培训者升级和下载文件和目录。
I am using Entity Framework as part of a project that should allow students and trainers to up- and download files and directories.
为了显示文档I调用db:
In order to show the documents I make a call to the db:
public static ObjectSet<Document> doc = frmFocus._context.Documents;
但是,这提供了所有属性,包括文件的实际数据。我想要做的只是检索与列表视图相关的内容,直到选择要下载的文件。
But this delivers all the properties including the actual data of the files. What I would like to do is retrieve only those that are relevant to the listview until the files to download have been selected.
这是可能的吗?我不能找到一种方式。
Is this possible? I haven't been able to find a way.
推荐答案
您可以标记要加载的内容属性延迟。
You can mark the content property to be loaded deferred.
您可以使用设计器轻松实现这一点。
You can easily achieve this using the designer.
或者您当然可以通过添加属性 IsDelayLoaded =true
到列元素。
Or you can of course directly edit the XML by adding the attribute IsDelayLoaded="true"
to the column element.
这篇关于使用LINQ / Entity Framework选择除一个属性之外的所有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!