Querying Data with LINQ to SQL
Before you begin querying data with LINQ to SQL, you need to instantiate the DataContext
class. Continuing with the console application example started in the previous section, you can declare such an instance at the module level as follows:
Private northwind As New NorthwindDataContext
Declaring a single instance at the module or class level allows one DataContext
to manage entities for all the object model lifetime.
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.