I want to get one property (blob) from one object (by identifier). I have:
context.References
.Single(r => r.ID == id)
.Blob;
This seems ineffective to me because I get the whole link only to drop everything except Blob. This led to
context.References
.Where(r => r.ID == id)
.Select(r => r.Blob)
.Single();
Which should be requested only by Blob, but the presence of Single as an afterthought at the end is somewhat annoying (but it is necessary to observe the singularity, which I consider necessary). My question is this: is there a better way to accomplish this, or is my second code block exactly as it is?
Thank!
source
share