Database Reference
In-Depth Information
Figure 3-17. Selecting database objects
14.
The Entity Data Model Wizard creates your conceptual model and displays it
in the Visual Studio IDE. You won't work with this directly, so close it. You do
need the form, so open it in Design view and place a ListBox on it, leaving the
default name listbox1.
15.
Double-click the form (not the ListBox) to display the code-behind and create
the form's Load event. You want to do something very simple: load the contacts
from the Contact table into the list box when the form loads. (In normal
circumstances, this wouldn't be a good idea; but because the table contains
only a few contacts, and this example is demonstrating the functionality of
querying an Azure database, you can let it slide.) In the Load event, enter the
following code:
using (EFAzureEntities context = new EFAzureEntities())
{
var query = from con in context.Contacts
select con;
foreach (var cont in query)
{
Search WWH ::




Custom Search