I want to get a single property(blob) from a single entity (by Id). I have:
context.References
.Single(r => r.ID == id)
.Blob;
This strikes me as inefficient, because I'm getting the entire Reference, only to discard everything except the Blob. This led to
context.References
.Where(r => r.ID == id)
.Select(r => r.Blob)
.Single();
Which should only query for the Blob, but having the Single as an afterthought at the end is somewhat annoying (yet enforcing the singularity I feel is necessary). My question is this: is there a better way to accomplish this, or is my second codeblock just the way it is?
Thanks!