ESDS Knowledge Base

06
Dec

Create CRUD in dotnet using dynamic data entity framework

Introduction:

To develop website without coding. Create, update, read, delete screen for each table with parent child relation. Dynamic data driven from database for basic data operations.

Overview:

This website helps to cross check the table’s relation by actually inserting and manipulating relevant data using input screens. Cross check data flows as expected or not, when it comes to prototype developer can rely on the database structure/schema.

Objective:

Allow developer to examine database structure reliability and take prior measures before using the database in developing website. Validate user input on basis of data type used in backend.

Steps to be followed:

1. Start Visual studio 2010, click on New Website under File tab template window will open.
2. Select C# & Asp.net dynamic data entities web site under templates.

1
3. Name the application and select web location where site is to be saved and click ok.
4. Once application is created right click on website in solution explorer and click Add New Item.
5. Select ADO.NET Entity Data Model click Add.

2

6. Entity Data model wizard will open select “Generate from Database” and click next.

3

7. Click on “New Connection…” Select server name, provide connection credentials and select database name.
8. Here I am using Employees database with 3 tables to track employee leaves.

4
9. Click on Test connection to make sure connection is successful.

5

10. Click ok and select radio option as “Yes, include the sensitive data in the connection string” and click next.
11. Select Tables checkbox in the next step and finish.

6
12. Entity data model designer will be populated with table’s structure and relation.
13. Now uncomment line number 26 below line within global.asax  //DefaultModel.RegisterContext(typeof(YourDataContextType), new ContextConfiguration() { ScaffoldAllTables = false });
14. Modify the line to DefaultModel.RegisterContext(typeof(employeesModel.employeesEntities), new ContextConfiguration() { ScaffoldAllTables = true });.
15. Good to build and run click F5 and default page shows link of all tables.

7

16. Create Page

8
17. List Page

9
18. Edit/Update Page

10

19. Thus we can check each table and its relation with other table and conclude if data is in relational.

Leave a Reply