title: Entity Framework 5 CodeFirst - "Column names in each table must be unique."
body: <p>I'm creating the following table on PostgreSQL:</p>
  
  <pre><code>create table dbo.user_ratings (
  user_id int not null,
  user_rated_id int not null,
  value decimal not null,
  status_id int not null,
  created_at timestamp with time zone not null,
  updated_at timestamp with time zone null,
  user_comment text null,
  
  primary key (user_id, user_rated_id),
  foreign key (user_id) references dbo.users(id),
  foreign key (status_id) references dbo.status(id),
  foreign key (user_rated_id) references dbo.users(id));
  </code></pre>
  
  <p>When mapping the table using CodeFirst, I'm doing the following:</p>
  
  <pre><code>[Table("user_ratings", Schema="dbo")]
  public class UserRating {
  
      [Key, Column("user_id", Order = 0)]
      public int UserId { get; set; }
      public virtual User User { get; set; }
  
      [Key, Column("user_rated_id", Order = 1)]
      public int UserRatedId { get; set; }
      public virtual User UserRated { get; set; }
  
      [Column("status_id")]
      public int StatusId { get; set; }
      public virtual Status Status { get; set; }
  
      public decimal Value { get; set; }
  
      [Column("user_comment")]
      public string UserComment { get; set; }
  
      [Column("created_at")]
      public DateTime CreatedAt { get; set; }
  
      [Column("updated_at")]
      public DateTime UpdatedAt { get; set; }
  }
  </code></pre>
  
  <p>Well, so far, so good. When I try to query something, I'm getting the error below:</p>
  
  <pre><code>Column names in each table must be unique. Column name 'User_Id' in table 'user_ratings' is specified more than once.
  </code></pre>
  
  <p>What is wrong with this? When I remove the mapping related to the column <code>user_id</code>, it's passing, but it's not right. Can someone help me?</p>
  
  <p>Thank you all!!!</p>