Showing posts with label What is the DataContext class and how is it related to LINQ?. Show all posts
Showing posts with label What is the DataContext class and how is it related to LINQ?. Show all posts

Friday 30 March 2012

What is the DataContext class and how is it related to LINQ?

What is the DataContext class and how is it related to LINQ?
After you add a LINQ to SQL Classes item to a project and open the O/R Designer, the empty design surface represents an empty DataContext class ready to be configured. The DataContext class is a LINQ to SQL class that acts as a conduit between a SQL Server database and the LINQ to SQL entity classes mapped to that database. This class contains the connection string information and the methods for connecting to a database and manipulating the data in the database. It is configured with connection information provided by the first item that is dragged onto the design surface.