The following just specify contraints on size, key, etc.
For Relationship Contraints, see IT:AD:Code First:FluentAPI:Relationships
It's done automatically if you the fieldname is called Id or TheEntitityId, but if you can't use that field name:
modelBuilder.Entity<Manager>() .HasKey(ma => ma.ManagerCode);
Use an anonymous object:
modelBuilder.Entity<Department>()
.HasKey(t => new { t.DepartmentID, t.Name });
modelBuilder.Entity<Manager>().Property(ma => ma.Name) .HasMaxLength(20);
modelBuilder.Entity<Department>().Property(dp => dp.Name) .IsRequired();
You can ignore calculated columns:
modelBuilder.Entity<Department>().Ignore(t => t.Budget);
modelBuilder.Entity<Department>().Property(t => t.Name)
.HasColumnName("DepartmentName");