Jun
25
2009

Excellent Tool for LINQ to SQL Coders

bluemarine_logo LINQ is an excellent technology, but moving from T-SQL syntax to LINQ syntax is not an easy jump when you start getting into complex queries.  Enter Linqer, a tool that converts SQL to LINQ.  I tried it out recently and it worked like a charm on some pretty hairy SQL.  When you put something like this:



SELECT AttributeTypes.TypeName, AttributeValues.AttributeValue
FROM  Attributes INNER JOIN
               AttributeValues ON Attributes.AttributeValueID = AttributeValues.ID INNER JOIN
               AttributeTypes ON Attributes.AttributeTypeID = AttributeTypes.ID AND AttributeValues.AttributeTypeID = AttributeTypes.ID
WHERE (Attributes.SystemID = 1)
Order by AttributeTypes.TypeName

 

into Linqer, you hit a button and get this:

from t in db.Attributes
join t0 in db.AttributeValues on new { AttributeValueID = t.AttributeValueID } equals new { AttributeValueID = t0.ID }
join t1 in db.AttributeTypes
      on new { t.AttributeTypeID, Column1 = t0.AttributeTypeID }
  equals new { AttributeTypeID = t1.ID, Column1 = t1.ID }
where
  t.SystemID == 1
orderby
  t1.TypeName
select new {
  t1.TypeName,
  t0.AttributeValue1
}

Using the tool actually helps you learn LINQ syntax more quickly as well.  Definitely worth the $60.

Home | Linqer

Leave a Reply

You must be logged in to post a comment.

SEO Powered by Platinum SEO from Techblissonline