title: EF6 Code first model ForeignKey
body: <p>i got the an exception when i am trying to generate the database out of the followed model.</p>
  
  <blockquote>
    <p>The ForeignKeyAttribute on property 'DataCenterBenchmark' on type
    'Benchmark.Data.Context' is not valid. The foreign key
    name 'BenchmarkId' was not found on the dependent type
    'Benchmark.Data.Context'. The Name value should be a
    comma separated list of foreign key property names.</p>
  </blockquote>
  
  <pre><code>[Table("Contexts")]
  public class Context
  {
      [Key]
      public Guid InternalId { get; set; }
  
      [Required] public string Name { get; set; }
      [Required] public string Cluster { get; set; }
      [Required] public string Token { get; set; }
      [Required] public string IP { get; set; }
      [Required] public string Memo { get; set; }
      [Required] public string BenchType { get; set; }
  
      [Required] public int InstanceCount { get; set; }
      [Required] public int ThreadCount { get; set; }
      [Required] public int RequestCount { get; set; }
  
      [Required] public DateTime CreationDate { get; set; }
      [Required] public DateTime EditDate { get; set; }
  
      [ForeignKey("BenchmarkId")]
      public Benchmark RemoteBenchmark { get; set; }
      [ForeignKey("BenchmarkId")]
      public Benchmark DataCenterBenchmark { get; set; }
      [ForeignKey("BenchmarkId")]
      public Benchmark IISBenchmark { get; set; }
      [ForeignKey("BenchmarkId")]
      public Benchmark LocalBenchmark { get; set; }
  
      [ForeignKey("MachineTypeId")]
      [Required] public MachineType MachineType { get; set; }
  }
  
  [Table("Benchmarks")]
  public class Benchmark
  {
      [Key]
      public int BenchmarkId { get; set; }
      [Required] public string Result { get; set; }
      [Required] public DateTime Duration { get; set; }
  }
  
  [Table("MachineTypes")]
  public class MachineType
  {
      [Key]
      public int MachineTypeId { get; set; }
      [Required] public string Name { get; set; }
  }
  
  public class BenchmarkContext : DbContext
  {
      public DbSet&lt;Context&gt; Contexts { get; set; }
      public DbSet&lt;Benchmark&gt; Benchmarks { get; set; }
      public DbSet&lt;MachineType&gt; MachineTypes { get; set; }
  }
  </code></pre>
  
  <p>Tried to fix it with some tutorials - no victory..</p>
  
  <p>Regards,
  Marc</p>
  
  <p>===== EDIT =====</p>
  
  <p>After removing the [ForeignKey] flags i can't connect to my SQL Server (Error 26). I set no database as connection string so EF6 needs to create a localdb..?</p>