.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
abhays
Clintonzz
cathyhill345
arronlee
mattyclown

Home >> Articles >> Azure >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Azure Part 29 - SQL Azure - Using ADO.NET Entity Framework - Creating DataModel

Posted By:Jean Paul       Posted Date: February 06, 2012    Points: 200    Category: Azure    URL: http://www.jeanpaulva.com/  

SQL Azure - Using ADO.NET Entity Framework - Creating DataModel
 

Another good remarkable point regarding SQL Azure is the reuse of our existing skills with ADO.NET Entity Framework.  As the SQL Azure connectivity using ADO.NET is possible, it opens the door for Entity Framework as well.

 

Abut ADO.NET Entity Framework

 

ADO.NET Entity Framework is an ORM (Object Relational Mapping) framework from Microsoft.  It provides the flexibilities like tables to entities, relational mapping to properties, Data operations to encapsulated methods etc. 

 

Surely it gives the advantages of:

 

  • Wrapping of database in Object Oriented Manner
  • More Manageability
  • More Flexibility
  • Less Development Time

 

But everything comes at the cost of learning.  You can find more information here.

 

Creating Schema

 

Create a new Windows Azure project and add a new web role into it.  After that right click on the project and use Add > New Item.  In the appearing dialog choose the Data item from the left pane and ADO.NET Entity Data Model from the right pane.

 

 

Enter the names as MyModel as shown above.  Click the Add button to continue to see the following screen.

 

 

In the above dialog choose the default option (Generate from database) and click the Next button to continue.

 

 

In the appearing dialog choose your existing connection from the drop down list and click Next to continue..

 

 

You will be prompted with the login dialog above.  Enter your user name and password to continue.  (The Save my password option saves the password to the connection string in config)

 

In the next dialog, select the tables as shown below and click Finish button.

 

 

This will generate the entity data model files in your project.  You can see that the Employee table from previous example is populated in the tables and it generates the Employee class as shown below.

 

 

Note: If your database does not contain the above table, you may need to create the table and repeat the operations.

Summary

 

In this article we have explored the scope of using ADO.NET Entity Framework on SQL Azure.  The possibilities give us more flexibility, control and reuse of our existing ORM skills.  The source code attached contains the Entity Data Model code.  You need to change the database name, user name and password in the configuration file.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend