By using the .IsRequired() method, properties can be specified as mandatory, which means that the column will have a NOT NULL constraint.
using System.Data.Entity;
// ..
public class PersonContext : DbContext
{
// ..
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
// ..
modelBuilder.Entity<Person>()
.Property(t => t.Name)
.IsRequired();
}
}
The resulting column with the NOT NULL constraint: