title: Entity Framework Code First - Virtual Property Column Naming
body: <p>I'm using EF Code First (4.3.1) on a personal ASP.NET MVC 3 project, with a very simple domain model, and I'm almost at the point where EF will generate the DB schema the way I want it to.</p>
  
  <p>The domain model has two classes: <code>Painting</code> and <code>Gallery</code>. Each <code>Painting</code> belongs to a single <code>Gallery</code>, and the <code>Gallery</code> has two virtual properties pointing to <code>Painting</code>: One to indicate which of the painting is it's cover image, and one for which of the paintings is the Slider image displayed on the home page.</p>
  
  <p>The classes are as follow. I've removed some annotations and irrelevant properties to make it readable.</p>
  
  <pre><code>public class Gallery
  {
      public Gallery()
      {
          Paintings = new List&lt;Painting&gt;();
      }
  
      [ScaffoldColumn(false)]
      [Key]
      public int GalleryId { get; set; }
  
      public string Name { get; set; }
  
      [ScaffoldColumn(false)]
      [Column("LaCover")]
      public Painting Cover { get; set; }
  
      [ScaffoldColumn(false)]
      [Column("ElSlider")]
      public Painting Slider { get; set; }
  
      [ScaffoldColumn(false)]
      public virtual List&lt;Painting&gt; Paintings { get; set; }
  }
  </code></pre>
  
  <p>and painting:</p>
  
  <pre><code>public class Painting
  {
      [ScaffoldColumn(false)]
      [Key]
      public int PaintingId { get; set; }
  
      public string Name { get; set; }
  
      public int GalleryId { get; set; }
  
      [Column("GalleryId")]
      [ForeignKey("GalleryId")]
      [InverseProperty("Paintings")]
      public virtual Gallery Gallery { get; set; }
  
      public string Filename { get; set; }
  }
  </code></pre>
  
  <p>It generates a correct db schema for both classes and its relationships, the only small issue I have is that I haven't found a way to control the column names it gives to the virtual properties of <code>Cover</code> and <code>Slider</code> in the <code>Gallery</code> table.</p>
  
  <p>It'll name them <code>Cover_PaintingId</code> and <code>Slider_PaintingId</code>.</p>
  
  <p>I tried using the <code>[Column("columnNameHere")]</code> attribute, but that doesn't affect it at all. As in "I typed a certain non related word and it didnt show up in the schema".</p>
  
  <p>I'd like to name it <code>CoverPaintingId</code>, without the underscore.</p>
  
  <p>Any help is greatly appreciated. Thanks</p>