entity-framework – Code First – Fluent API – Required properties (NOT NULL)

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:

enter image description here

if you want to reproduce, please indicate the source:
entity-framework – Code First – Fluent API – Required properties (NOT NULL) - CodeDay