EF Code First and capitalization
Posted: Mon 15 Jun 2015 20:30
Hello,
I have been having a problem when using code first for talking to an oracle database. The problem is that I would like to use non capitalized properties/tables, but I keep getting exceptions when I try it. Here is an example of an entity:
[Table("DEPARTMENTS2")]
public partial class Departments2
{
[Column("ID")]
public int Id { get; set; }
[Required]
[StringLength(50)]
[Column("DESCRIPTION")]
public string Description { get; set; }
}
Please notice that I have to change via annotations the capitalization of the name of tables and fields, otherwise I get an exception like "table or view not found" when trying to query the table Departments2 from EF. Is it mandatory to do it like this or there is a solution to my problem?
Thanks.
I have been having a problem when using code first for talking to an oracle database. The problem is that I would like to use non capitalized properties/tables, but I keep getting exceptions when I try it. Here is an example of an entity:
[Table("DEPARTMENTS2")]
public partial class Departments2
{
[Column("ID")]
public int Id { get; set; }
[Required]
[StringLength(50)]
[Column("DESCRIPTION")]
public string Description { get; set; }
}
Please notice that I have to change via annotations the capitalization of the name of tables and fields, otherwise I get an exception like "table or view not found" when trying to query the table Departments2 from EF. Is it mandatory to do it like this or there is a solution to my problem?
Thanks.