Open up your visual studio and create a new project and then add a linq-to sql data class and then drag and drop tables from your Database into your data class. Then instantiate your context object as:
In above code we have used lambda expression x=>x along with where method.
And after or comment we have used Linq query syntax which is quite similar to SQL.
Both of these queries fetch data from Inventories table. But if you notice carefully method presented below or is much more readable and is most commonly used when we have to write complex queries. This syntax might be confusing for people which are new to linq. So in order to make it simpler we can use a tool named linqpad available from linqpad.net.
Above given is a screen shot from linqpad from where you can select your Database and write in a query as:
Now this query returns a list of products as IOrderedQueryable Type.
You can go through the samples also wherein various examples of how to fetch data and write queries are shown.
In addition to above Linqpad also allows you to query your entity model you just need to add a reference to your project DLL and it would automatically pull up everything from it.