If you already have a database schema defined, you can
use it to quickly create LINQ to SQL entity classes modeled off of it.
The easiest way to accomplish this is to open up a database
in the Server Explorer within Visual Studio, select the Tables and Views you
want to model in it, and drag/drop them onto the LINQ to SQL designer surface:
Figure 4
When you add the above 2 tables (Categories
and Products) and 1 view (Invoices) from the "Northwind"
database onto the LINQ to SQL designer surface, you'll automatically have the
following three entity classes created for you based on the database schema:
Figure 5
Using the data model classes defined above, I can now run
all of the code samples (expect the SPROC one) described in Part 1 of this LINQ to SQL series. I don't need to
add any additional code or configuration in order to enable these query,
insert, update, delete, and server-side paging scenarios.