title: MVVM Light and SQL Server CE generated code in viewmodel
body: <p>I'm just having a play with MVVM Light and I think I got my head around it but I have a problem.</p>
  
  <p>I'm using the SQL Server CE Toolbox which generates the classes, mappings etc for my database (SQLCE). One of the table's is called Profile and I wanted to use this as property that I can bind too. Here is my code for the ViewModel</p>
  
  <pre><code>public class ProfileViewModel : ViewModelBase
  {
      private Profile profile; // Profile is the class created by SQLCE Toolbox for table mapping
  
      public Profile UserProfile 
      {
          get { return profile; }
          set
          {
              profile = value;
              RaisePropertyChanged("UserProfile");
          }
      }
  
      public ProfileViewModel()
      {  
          if (IsInDesignMode)
          {
              // Code runs in Blend --&gt; create design time data.
              UserProfile = new Profile()
              {
                 Name = "NA",
                 Age = 22
              }
          }
          else
          {
              // Code runs "for real"
              UserProfile = GetProfile(); 
          }
      }
  }
  </code></pre>
  
  <p>In Expression blend I can see the ViewModel but not the Profile property so I'm guessing an exception is being generated somewhere. </p>
  
  <p>I did try attaching blend as a process but no errors came up. After a little reading and I see that blend can't connect to the database so you have to make up some data when in DesignMode. I tried just doing <code>UserProfile = new Profile()</code> but I am guessing it is still trying to use the database to create it?</p>
  
  <p>EDIT:
  Ok the issue I am having I think is related to using SQLCE. If I try something similar with WPF and MS SQL then everything works fine.</p>
  
  <p>EDIT 2:
  This is deffinatly related to the database. If I remove the public property UserProfile from the code above then all the other properties (not shown in my code) can be seen from Blend. If I add it back then none are visable. So how can I make it blendable?</p>