Wednesday, December 1, 2010

CAML vs Linq : round two

A while ago I wrote a post about CAML And Linq when working on MOSS, that post was giving an example of what and when to use each one of them ( when you work on MOSS).

Since that post, a newer version of SharePoint came out, the 2010.
Which is definitely worth writing another part ( update ) for that post.

Actually, I should start with the end result, now you can use Linq in all cases and you will get same results ( only in SharePoint 2010 ).

Now, there is the - how come ? Answer : SPMetal.

What SPMetal does ? In a nut shell, creates an entity class that provide another layer in which your Linq code can access directly to the database ( content db ).
Which is in other words, give you the same performance you could only achieve with CAML queries.

So, if you work with SharePoint 2010 you can work with Linq always. You got my approval :)