1

I'm using Entity Framework 5 to Microsoft azure server. I have a table with millions of records in it. I need to add two columns and update them to given values. I wrote the code as follows:

public override void Up()
{
    AddColumn("dbo.MST_FarmerProfile", "Season", c => c.String(maxLength: 500));
    AddColumn("dbo.MST_FarmerProfile", "Year", c => c.Int());

    Sql("Update MST_FarmerProfile Set Season='Kharif' where Season is NULL");
    Sql("Update MST_FarmerProfile Set Year=2013 where Year is NULL");
}

public override void Down()
{
    DropColumn("dbo.MST_FarmerProfile", "Year");
    DropColumn("dbo.MST_FarmerProfile", "Season");

}

After deploying it in Azure server, I'm constantly getting 'The wait operation timed out' exception and nothing is working.

Zizouz212
  • 4,908
  • 5
  • 42
  • 66
Saket Kumar
  • 4,363
  • 4
  • 32
  • 55
  • You can remove the "where" which prevents an expensive index scan. But I think you should define the new columns as `not null` with default value. Make columns `not null` whenever possible. – Gert Arnold May 02 '14 at 12:39
  • 1
    Have you tried increasing the time out value ? Try this if not : http://stackoverflow.com/questions/12788972/set-database-timeout-in-entity-framework – Sri Kanth May 02 '14 at 16:55

0 Answers0