I am using entity framework (for learning) to create the datatable; however, when I run the application, it creates the database column name as: AnaKategori_ANA_CATEGORY_ID.
Why is it doing that since I am specifically telling it to name the column as "ANA_CATEGORY_ID"?
Below is the class files content.
[Table("CATEGORY")]
public class Kategori
{
[Key]
public Guid CATEGORY_ID { get; set; }
[MaxLength(100)]
public string CATEGORY { get; set; }
[MaxLength(100)]
public string CATEGORY_TR { get; set; }
[Column("ANA_CATEGORY_ID")]
public virtual AnaKategori AnaKategori { get; set; }
}
I tried boindiil's answer prior to posting (which was to use ForeignKey Attribute and I got this error:
The ForeignKeyAttribute on property 'AnaKategori' on type 'BusinessListingMVC.Models.Kategori' is not valid. The foreign key name 'ANA_CATEGORY_ID' was not found on the dependent type BusinessListingMVC.Models.Kategori'. The Name value should be a comma separated list of foreign key property names. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.