title: Entity Framework Relations With Fluent Api
body: <p>I'm using Entity Framwork 6.0.2 and I'm trying to create a relationship one to one with User and UserLogged with Id's. I'm using EntityTypeConfiguration (Fluent API) and I'm not getting. See below my code:</p>
  
  <pre><code>public class User
  {
  
      public Int64 UserId { get; set; }        
  
      public String Name { get; set; }
  
      public String Surname { get; set; }
  
      public String Email { get; set; }
  
      public String Login { get; set; }
  
      public String Password { get; set; }
  
      public DateTime RegisterDate { get; set; }
  }
  
  public class UserLogged
  {
  
      public Int64 UserId { get; set; }
  
      public String ComputerName { get; set; }
  
      public String AddressIp { get; set; }
  
      public String AddressMac { get; set; }
  
      public virtual User User { get; set; }        
  }
  
  public class UserLoggedMap : EntityTypeConfiguration&lt;UserLogged&gt;
  {
      public UserLoggedMap()
      {
          this.HasKey(u =&gt; u.UserId);
          this.HasRequired(u =&gt; u.User).WithOptional(u =&gt; u.UserId);            
      }
  }
  </code></pre>
  
  <p>Thank you much.</p>