Q:

mvcScaffolding / EF Code First creates column for related table as though to insert the related table

Hi i am using MVCScaffolding, with MySQL  its a bit of a pain but i have this:
public class SubCategories
{
    [Key, Display(Name = "ID"), HiddenInput(DisplayValue = false), Required]
    public Int32 SubCategoriesId { get; set; }

    [Required, Display(Name = "Name")]
    public string SubCategoriesName { get; set; }

    [Required, Display(Name = "Active")]
    public bool SubCategoriesShow { get; set; }

    [Required, Display(Name = "Category")]
    public Int32 CategoriesId { get; set; }

    [ScaffoldColumn(false)]
    public virtual Categories Categories { get; set; }

}

and
public class Categories
{
    [Key, Display(Name = "ID"), HiddenInput(DisplayValue = false), Required]
    public Int32 CategoryId { get; set; }

    [Required,Display(Name = "Name")]
    public string CategoryName { get; set; }

    [Required,Display(Name = "Active")]
    public bool CategoryShow { get; set; }
}

this is great and when i add a sub category, it creates a dropdwon of categories, but it also creates the column Category_CategoriesId   this i dont want, i have tried to set scaffolding to false but this doesent seem to work eith
help very much appreciated
thanks

A:

I am not sure, what about [Column("name")]?
I tought about adding [Editable(false)] for what you have already solved.
to help you close it
Adding [ForeignKey("CategoriesId")] to virtual Categories in Sub Categories fixes it.

