title: Entity Framework Not Recognizing Foreign Key?
body: <p>I'm trying to set a variable like so...</p>
  
  <pre><code>var userID = WebMatrix.WebData.WebSecurity.CurrentUserId;
  var options = db.UserProfiles.Find(userID).TaskTypeSetting;
  </code></pre>
  
  <p>I'm using the user authentication table provided by the basic Internet Application template.</p>
  
  <p>Row <code>UserId</code> in table <code>UserProfile</code> has a <em>one-to-many relationship</em> with row <code>User</code> in table <code>TaskTypeSetting</code>.</p>
  
  <p>It is telling me that it cannot find a definition for <code>TaskTypeSetting</code>. Shouldn't I be able to do this if my relationships are set up properly?</p>
  
  <p>Here is the model for the table:</p>
  
  <pre><code>namespace DailyTaskList.Models
  {
      using System;
      using System.Collections.Generic;
  
      public partial class TaskTypeSetting
      {
          public int ID { get; set; }
          public int Type { get; set; }
          public int User { get; set; }
      }
  }
  </code></pre>
  
  <p>It looks like it's not adding the relationship to the code? The .edmx diagram shows the relationships as I have them set up.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>UserProfile class definition:</p>
  
  <pre><code>namespace DailyTaskList.Models
  {
      using System;
      using System.Collections.Generic;
  
      public partial class UserProfile
      {
          public int UserId { get; set; }
          public string UserName { get; set; }
      }
  }
  </code></pre>
  
  <p><strong>Compiler Error Message:</strong> CS1061: 'DailyTaskList.Models.UserProfile' does not contain a definition for 'TaskSetting' and no extension method 'TaskSetting' accepting a first argument of type 'DailyTaskList.Models.UserProfile' could be found (are you missing a using directive or an assembly reference?)</p>
  
  <p>I'm also getting this under Mapping Details:</p>
  
  <pre><code>Mappings are not allowed for an association over exposed foreign keys.
  </code></pre>