Correcting table name casing using Data Annotations in Entity Framework 6

70 views Asked by At

I am trying to correct the casing of some tables in my model by using Data Annotations in Entity Framework 6.
Some tables in the database are wrongly cased as SomeTable but cannot be renamed.

The fix for this should be in the model like this:

[Table("SomeTable")]
public class Sometable
{
    …
}

However, this wrongly triggers a migration in the Entity Framework which includes both a CreateTable("SomeTable") and a DropTable("SomeTable") in the same Up() method, which obviously does not make sense.

Is there any way to force Entity Framework to understand that this table actually exists and it is just the casing that have changed?

0

There are 0 answers