...now browsing by tag


Dynamic Data Entities Web Application

Monday, August 25th, 2008

Today, I started playing with the new Visual Studio 2008 Service Pack 1. The download was massive (800mb) and installer wanted 4 gb free, so as a few people around the web have been saying it is almost like a new release (read Visual Studio 2009).

Any ways, coming back to the Dynamic Data Entities, I first saw a glimpse of this feature in Sql Sever 2008 presentation (read my prev. post), and was thinking this is cool, so gave it a go…It was simple in VS 2008 with SP1 you basically go to File > New > and chose ‘Dynamic Data Entities WebApplication’ project; VS gives us the usual web application template along with a new folder called “DynamicData” and this folder contains all the files required to generate dynamic data drive web application. Next click on Add New > ADO.NET Entity Data Model and follow the steps in the wizard. At the end of this step you will have a simple Entity model of the various table from the SQL Server.

With the entity model in place all we have to do now is edit the Global.asax file and read the instructions which are in the comments. I have put in the name of my model and chose true for ScaffoldAllTables.

model.RegisterContext(typeof(MyEntities), new ContextConfiguration() { ScaffoldAllTables = true });

With that step done…did the build and lo..and behold you get this simple interface which lists all the tables in the model and gives the user the ability to page thru the data in each table by rendering the data in Grid View and gives the options to perform CRUD (Create/Read/Update/Delete) operations. The cool thing is till now I haven’t done any code except for editing the above one line.

Search Feature

This is one thing that is currently missing in the entity driven web app. Currently I am investigating how I can implement this feature. If any of you know how, please let me know.

Written by Deepak Vasa - Visit Website

Row number in GridView — the best way !!!

Friday, May 30th, 2008

<%# Container.DataItemIndex + 1 %>

Written by Deepak Vasa - Visit Website