Wednesday, 27 February 2008

Rob Conery » Creating IN Queries With Linq To Sql

I like it when someone explains a concept in terms I can understand.

Rob Conery » Creating IN Queries With Linq To Sql

LINQ can be very frustrating when you are used to writing SQL directly. I get the idea that it's probably a good thing not to worry too much about the SQL generated and to think in terms of what you actually need to find from the database. Let LINQ sort out the detail of the query, the developers have spent a lot of time optimising their LINQ queries, maybe we should just trust them.

Link

Wednesday, 6 February 2008

Left/Right Joins LINQ way too complicated in VB9

I was recently trying to use LINQ to join two tables using a Left Join, nothing complicated, in fact here's the SQL I was trying to replicate

select L.* from tbllocation L left join tblItem I on L.locationid = I.locationid where I.Locationid is null

I couldn't figure out how to do this, turning to Google I found this article

The Visual Basic Team : Converting SQL to LINQ, Part 8: Left/Right Outer Join (Bill Horst)

which is part of this excellent series or articles

Converting SQL to LINQ by Bill Horst

Bill states that "VB9 doesn't yet have smooth support for Left or Right Joins" and comes up with a solution using the group join. In my opinion this is far too complicated to me to use reliably. I'm sure I'd get it eventually but for now I've reverted back to using a simple stored procedure to return the information I want.

LINQ is good and I enjoy having my intellisensed database; sometimes however, LINQ can get in the way and I just need to get the job done.

Link