KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I refer to this example: Return selected specified columns Quote: If BlobDetails isn't the LINQ entity, then you can do it directly: var qry = from b in dc.Blobs orderby b.RowVersion descending select new BlobDetails { Id = b.Id, Size = b.Size, Signature = b.Signature, RowVersion = b.RowVersion}; return qry.ToList(); I see that they are selecting specific column in a query through the ORM-tool LINQ TO SQL. Critics of ORM-tools say that, if I remember correctly, that ORM-tools select and return entire objects from the table, and limits the options of selecting only specific columns as one can do through classic SQL-programming. Of course, I have my doubts about that when I see this example, but nevertheless, I still keep asking myself the question: Does the database return only the selected columns, or does it return the entire objects, leaving the column-filtering to the ORM-tool? From this example, they also have a class called Blobdetails: public class BlobDetails { public int Id { get; set; } public string Signature { get; set; } public int Size { get; set; } public System.Data.Linq.Binary RowVersion { get; set; } } Do I need to create my own classes everytime I only wish to select a few columns from a table through LINQ?
Tags (comma-separated)
Save Edits
Cancel