Azure database, database project and EDMX

In the previous article we have created Solution that has Web Role. It allows us to publish this solution on Windows Azure. Also, in this solution we have a connection to created storage account in Azure. We have log manager Log4net that allows us to write some logs in Blob table. In last article we have created a database in Windows Azure SQL server and a database project for this database. So now we can start to use this database in our solution. We will use Entity Framework for this purpose. Entity Framework allows generating entity classes from the database. 

EDMX

We will use EDMX file to do this. A .edmx file is an XML file that defines a conceptual model, a storage model, and the mapping between these models. An .edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically. The recommended practice for creating an .edmx file is to use the Entity Data Model Wizard.

In the first step we should open our “MvcApplicationWebRole” solution. Now let’s add a new class library in our solution. Right click on the solution then “Add – New project”. In occurred window enter name “MvcApplicationWebRole.Database” and select “Class Library” as project type:

Add new project in solution

Add new project in solution

  More...