Using the data annotation Required like so:
[Required]
public int somefield {get; set;}
Will set somefield to Not Null in database, How can I set somefield
to allow NULLs?, I tried setting it through SQL Server Management Studio but Entity Framework set it back to Not Null.
Just omit the [Required] attribute from the
string somefieldproperty. This will make it create aNULLable column in the db.To make int types allow NULLs in the database, they must be declared as nullable ints in the model: