Using LINQ to SQL - Part 2
page 2 of 11
by Scott Guthrie
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 45221/ 100

Create a New LINQ to SQL Data Model

You can add a LINQ to SQL data model to an ASP.NET, Class Library or Windows client project by using the "Add New Item" option within Visual Studio and selecting the "LINQ to SQL" item within it:

Figure 2

Selecting the "LINQ to SQL" item will launch the LINQ to SQL designer, and allow you to model classes that represent a relational database.  It will also create a strongly-typed "DataContext" class that will have properties that represent each Table we modeled within the database, as well as methods for each Stored Procedure we modeled.  As I described in Part 1 of this blog post series, the DataContext class is the main conduit by which we'll query entities from the database as well as apply changes back to it.

Below is a screen-shot of an empty LINQ to SQL ORM designer surface, and is what you'll see immediately after creating a new LINQ to SQL data model:

Figure 3

View Entire Article

User Comments

Title: LInq to Sql   
Name: praveen
Date: 2010-11-08 4:24:52 AM
hi ...this example was good...your practical approach was good..
Title: sample code   
Name: SirReadALOT
Date: 2010-04-08 6:49:21 PM
hi would it be possible to downlad the application?
Title: stored procedure   
Name: pappu reddy
Date: 2009-03-18 6:09:56 AM
can u give any other implementation

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-05-25 11:18:19 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search