Thursday, January 3, 2013

Dynamic Data Entities Web Application with Entity Framework

In this article I will explain how we can work with Dynamic Data Entities Web Application which is available at the time of creating a project.
In this article I will show how we can implement CRUD operation without writing a single line of code, and by just un-commenting a line in Global.asax file.
The only thing you have to do is to add a reference in Global.asax file with your project name you created. As my project name dynamicdataentities I will add this as a reference as follows
using dynamicdataentities;

The only thing you have to do after this is to un-comment this line of code from Global.asax file
DefaultModel.RegisterContext(typeof(YourDataContextType), new ContextConfiguration() { ScaffoldAllTables = false });

You have to replace this with the following
DefaultModel.RegisterContext(typeof(codeDBEntities), new ContextConfiguration() { ScaffoldAllTables = true });

Here codeDBEntities is nothing but the connection string which is available in Web.config file or you can find it in Model.edmx

First let us create a project by selecting ASP.NET Dynamic Data Entities Web Application as follows

This will create a project with a Master page, a Default page, a Global.asax file along with script and css.
Now let us add Ado.NET Entity Data Model as we did in our last article

As I am already having an connection I am not showing how to add connection, I will proceed with what I have

Open Global.asax file from the solution explorer

You can find some code with comments, we will un-comment the one we needed as follows

Here in place of YourDataContextType you have to replace your context type which will be available in web.config or in Model.edmx

Now run your application

As I integrated 2 tables it is showing those tables, select the required to perform CRUD operations.
I selected Employee and the details are as follows

In the department dropdown you can find out the entire department listed as follows

If I select any that corresponding details were shown as follows

Inserting details to Employee table, if you select Insert New Item it will display as follows

Edit Update screen

Deleting a record:

Before delete: I will delete one of the record


After delete:

 Viewing Employees from Department

Details of selected Employee

Any comments welcome..

Please do feel free to ask for any queries...


  1. The .NET Web Development and Tools group shipped a Dynamic Data project template with VS2012 that hard fails on the first line of code and the failure can be fixed by a simple mod to the template.

    I guess DynamicData is a dying technology afterall. Hopefully the ASP.NET MVC team will pick it up an integrate it into ASP.NET MVC.

  2. The Enterprise Structure is a set of technology in ADO.NET that support the development of data-oriented programs. Designers and designers of data-oriented programs have fought with the need to achieve two very different goals. They must model the organizations, connections, and reasoning of the business problems they are fixing, and they must also perform with the information engines used to store and recover the information. The information may span multiple storage space systems, each with its own protocols; even programs that perform with a single storage space program must balance the specifications of the storage space program against the specifications of writing efficient and maintainable application code.

  3. Excellent post, I agree with you 100%! I’m always scouring the Internet for new information and learning whatever I can, and in doing so I sometimes leave comments on blogs. Web Designing || Web Designing in Mumbai || Website Maintenance

  4. It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us. CMS Website Design || CMS Website Developer || CMS website development company

  5. Thanks for nice post. It is complicated to me now, but in typical, the efficiency and significance is annoying. Very much thanks again and best of luck! Thanks for sharing. Website Maintenance in Mumbai || Website Development || Website Development in Mumbai

  6. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me. Dynamic Website Designing || Dynamic website Designing in Mumbai || Ecommerce website Designing

  7. Nice Posting! because there are a lot of informative postings so, thanks a lot for sharing the information. Ecommerce website Designing in Mumbai || Ecommerce Solution || Ecommerce Solution in Mumbai

  8. Thanks for your valuable comments. Please let me know if you need any help, I am always there to help


Popular Posts