I have a LINQ query that ends with .Min(mytable.Id). This will return an integer. I then have to do another query to pull that object from that table. Is there a way to do this without writing two queries?
I could put the .Min() query as a subquery but is that any faster than two separate queries?
.OrderBy(m => m.Id).FirstOrDefault();
should do it without any additional dependencies.
Since its deferred, this will be pretty quick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With