ASP.NET ~ Create LINQ to SQL Classes


To create a class from a database table

1.If you are working with a Web site project, and the project does not already have an App_Code folder, in Solution Explorer, right-click the project, click Add ASP.NET Folder, and then click App_Code.

2.In Solution Explorer, right-click the App_Code folder (for a Web site project) or the project (for a Web application project) and then click Add New Item.

3.Under Installed templates, select Linq to SQL Classes template, type a name for the .dbml file, and then click Add.
The Object Relational Designer window is displayed.

4.In Server Explorer, drag the database tables or other objects (such as views) that you want to use with LINQ to SQL into the Object Relational Designer window.

The tables and their columns are represented as a entities in the designer window.

5.Save the .dbml file.


http://msdn.microsoft.com/en-us/library/bb907587%28v=vs.100%29.aspx

沒有留言: