Sunday 16 May 2010

Dynamic Data

Open a new "Dynamic Data Website"

Right Click "App Data", "Add Existing Item", select database file.

Right Click the Project Folder, "Add New Item", "LINQ to SQL Classes" give same filename as database file (eg"Northwind"), place in "App Folder"

"Server Explorer", expand 'databasename'.mdf, under "Tables", drag items onto page.
Then"Save All".

In "Solution Explorer", open ".designer.cs" page, copy "public partial class" name ( "NorthwindDataContext").

Open "Global.asax" page, locate line starting with:
"//model.RegisterContext"

Uncomment the code by deleting the forward slashes i.e. "//".

Paste class name over "YourDataContextType".

Change "ScaffoldAllTables" from "false" to "true".

Run the page by clicking on the "Play" button.

No comments:

Post a Comment