database - Is there any overhead with LINQ or the Entity Framework when getting large columns as part of an entity? -
Assume that you have a table with text and you want to leave a list of actual articles and display a list of them. When you get a list of article objects using the LINQ or the unit framework, is it too much overhead to get that text column too? I believe that when you start enumerating the list, article text will be stored in memory until the objects are disposed of.
So would it be wise to create an intermediate object that does not have a text column? If so, how would you do this? Make a square within your DAL, allow ORM to create one by itself, or by establishing another process.
If you do not need data then you should definitely make a different type. From the conference I usually give the name "nnnInfo" or "nnnListItem" such a class. To create ArticleListItem in L2S, simply drag your datacentext designer to the table for the second time, then rename it 'paragraphist item' with 'Article 1' and delete the unnecessary properties (RT click, delete). In EF, the process will be identical. As Craig Notes, you can use anonymous forms, but by creating a solid type, you can reuse in your app, you can expose through the services.
Another way to do this is to manually create a class and type an extension method to return to ArticleListItem:
public static IQueryable & lt; ArticleListItem & gt; ToListItems (this IQueryable & lt; paragraph & gt; article) {Choose a new ArticleListItem from the return from an article {title = a.Title, ...}}
"Cast" will allow ArticleListItem as a question against Article ...
Comments
Post a Comment