Entity Framework configuration
My approach is to keep the XxxxxDbContext class as lightweight as possible:

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    new ModelCreator().Execute(modelBuilder);
}




The ModelCreator class looks like this:

internal class ModelCreator
{
    public void Execute(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
        modelBuilder.Conventions.Remove&lt;OneToManyCascadeDeleteConvention&gt;();

        modelBuilder.Configurations.Add(new FirmConfiguration());
        // etc.
    }        
}




Then each table has its own EntityTypeConfiguration&lt;TEntityType&gt;:

internal class FirmConfiguration : EntityTypeConfiguration&lt;Firm&gt;
{
    public FirmConfiguration()
    {
        HasKey(x =&gt; new { x.Id });

        Property(t =&gt; t.Name).HasMaxLength(30).IsRequired();
        Property(t =&gt; t.Address).HasMaxLength(120).IsRequired();
        Property(t =&gt; t.PostalCode).HasMaxLength(4).IsRequired();
        Property(t =&gt; t.City).HasMaxLength(30).IsRequired();
        Property(t =&gt; t.Responsible).HasMaxLength(30).IsRequired();
        Property(t =&gt; t.Email).HasMaxLength(40).IsRequired();
        Property(t =&gt; t.Phone).HasMaxLength(14);
    }
}