How to remove underscore in foreign key names generated by Entity Framework 4.1

Viewed 3223

I have a relationship using Entity Framework 4.1 and my foreign key's is generated automatically, the names of foreign key have underscore:

public class Setor : Entity
{
    public long Id { get; set; }
    public string Nome { get; set; }
    public virtual Secretaria Secretaria { get; set; }
}

public class Secretaria : Entity
{
    public long Id { get; set; }
    public string Nome { get; set; }
}

This generated foreign key named: Secretaria_Id in table Setor

I want to remove this underscore: SecretariaId

Is there a way to do this? I prefer using DataAnnotations.

1 Answers
Related