بعد از ایجاد فایل Configuration.cs در پوشه Migrations توسط فرمان enable-migrations دستور زیر را در سازنده کلاس بنویسید
AutomaticMigrationsEnabled = false;
فرمان enable-migrations بصورت زیر می باشد
enable-migrations -ContextTypeName Repository.PhoneBookContext -MigrationsDirectory:Migrations\PhoneBookContextMigration
تغیرات زیر را در DbContext جهت فقط خواندنی کردن آن اعمال کنید
public class MyReadOnlyContext : DbContext
{
    // Use ReadOnlyConnectionString from App/Web.config
    public MyReadOnlyContext () : base("Name=ReadOnlyConnectionString")
    {
           Configuration.LazyLoadingEnabled = false;
           Configuration.ProxyCreationEnabled = false;
           Configuration.ValidateOnSaveEnabled = false;
           Configuration.AutoDetectChangesEnabled = false;
    }
    // Don't expose Add(), Remove(), etc.
    public DbQuery<PhoneBook> PhoneBooks
    {
        get
        {
            // Don't track changes to query results
            return Set<PhoneBook>().AsNoTracking();
        }
    }
    public override int SaveChanges()
    {
        // Throw if they try to call this
        throw new InvalidOperationException("This context is read-only.");
    }
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        // Need this since there is no DbSet<Customer> property
        modelBuilder.Entity<PhoneBook>();
    }
} 
