c# - Return selected specified columns -
I want to select only a few columns from a certain Blobes table. I have fields: ID, rovers, size, sign, blob, and I only want to select the first four. I do it like this: (---> is an error spot)
public list & lt; BlobDetails & gt; GetAllBlobsNames () {RichTekstModelDataContext DC = New RichTekstModelDataContext (); Var allBlobs = b to dc.Blobs By order B. Harverson descending selection new {BIID, B. Size, b. Signature, b. Rowersian}; --- & gt; AllBlobs.ToList & LT; BlobDetails & gt; (); } Public Square BlobDetails {Public Ent ID {get; Set; } Public string sign {get; Set; } Public int size {get; Set; } Public System data link. Binary Roversan {Received; Set; }} When I am trying to return BlobDetails - then VS.08 errors have been detected that to convert from unknown type (all blobs) into lists Not the way.
I do not want to select all the values, because the Blob field can be quite heavy and I do not want to send it all the time.
Do you have any idea how <<> <<> << / <> << / <> << / LINQ unit, you can straighten it: < / P> However; If
var qry = b by dc.Blobs command b.RowVersion descending by new BlobDetails {id = bid, size = b. Size, sign = b. Signature, Roverson = B. Harverson}; Return qry.ToList (); BlobDetails is is a LINQ unit, then you need to use subtrefuge:
var qry = b to dc.Blobs By order b.RowVersion descending select new {BIID, b. Size, b. Signature, b. Rowersian}; Var typedQry = q to qry.AEEnumerable () Select new BlobDetails {id = bid, size = b. Size, signature = b. Signature, Roverson = B. Harverson}; Return typedQry.ToList (); Assableable This works, which breaks the LINQ structure.
Comments
Post a Comment