title: Service Error when accessing windows azure DB from windows phone
body: <p>receiving the error:</p>
  
  <p>The EntitySet 'User' is not defined in the EntityContainer 'festDBEntities'. Near simple identifier, line 1, column 46.</p>
  
  <p>my app code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Net;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Animation;
  using System.Windows.Shapes;
  using Microsoft.Phone.Controls;
  using FestCloud.festDBService;
  
  namespace FestCloud
  {
      public partial class MainPage : PhoneApplicationPage
      {
          private Service1Client _serviceClient;
  
          // Constructor
          public MainPage()
          {
              InitializeComponent();
              _serviceClient = new Service1Client();
              _serviceClient.LoginUserCompleted += new EventHandler&lt;LoginUserCompletedEventArgs&gt;(_serviceClient_LoginUserCompleted);
          }
  
          void _serviceClient_LoginUserCompleted(object sender, LoginUserCompletedEventArgs e)
          {
              if ((e.Error == null) &amp;&amp; (e.Result != null))
              {
                  MessageBox.Show("Welcome " + e.Result + " !");
              }
              else
              {
                  MessageBox.Show("Could not log in. Please check user name/password and try again.");
              }
          }
  
          private void logInButton_Click(object sender, RoutedEventArgs e)
          {
              _serviceClient.LoginUserAsync(userNameTextBox.Text, passwordTextBox.Text);
          }
  
          private void newAccountButton_Click(object sender, RoutedEventArgs e)
          {
              NavigationService.Navigate(new Uri("/Register.xaml", UriKind.Relative));
          }
      }
  }
  </code></pre>
  
  <p>and my service code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  using System.Data.Objects;
  
  namespace CloudServiceRole
  {
      // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
      public class Service1 : IService1
      {
          public void AddUser(string userName, string password)
          {
              using (var context = new festDBEntities())
              {
                  context.AddToUsers(new User()
                  {
                      UserName = userName,
                      Password = password,
  
                  });
                  context.SaveChanges();
              }
          }
  
          public string LoginUser(string username, string password)
          {
              string query = @"SELECT value User.UserName FROM festDBEntities.User AS User WHERE User.UserName = @username AND User.Password = @password";
  
              ObjectParameter[] parameters = new ObjectParameter[2];
  
              parameters[0] = new ObjectParameter("username", username);
              parameters[1] = new ObjectParameter("password", password);
  
              using (var context = new festDBEntities())
              {
                  ObjectQuery&lt;string&gt; results = context.CreateQuery&lt;string&gt;(query, parameters);
  
                  foreach (string result in results)
                  {
                      if (result != null)
                      {
                          return result;
                      }
                  }
              }
              return null; ;
          }
      }
  }
  </code></pre>
  
  <p>my IService.cs file:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  
  namespace CloudServiceRole
  {
      // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
      [ServiceContract]
      public interface IService1
      {
          [OperationContract]
          void AddUser(string userName, string password);
  
          [OperationContract]
          string LoginUser(string userName, string password);
          // TODO: Add your service operations here
      } 
  }
  </code></pre>
  
  <p>My DB contains UserId(int)-PK, UserName(nvarchar), Password(nvarchar)
  with others to be added after I get basics working.
  any ideas on whats causing the error or my code in general?
  Many thanks,MH</p>