I am playing around with EF 5 and code first. So far I really like it, but I have noticed it defaults string columns to nvarchar. If I want to use varchar, then I have to explicitly tell it to.
I can force it to use varchar instead of nvarchar for strings as follows:
public class Member
{
public int id { get; set; }
[MaxLength(255), Required, Column(TypeName = "varchar")]
public string firstName { get; set; }
[MaxLength(255), Required, Column(TypeName = "varchar")]
public string surname { get; set; }
}
I would typically use varchar instead of nvarchar in almost all cases though, so I would much prefer to have string columns globally mapped to varchar, and to be able to set nvarchar on a per-column basis as above if I need to.
Does anyone know a way to do this? I am trying to omit the need for typing [Column(TypeName = "varchar")] for every string column in my model.