2013-08-29 4 views
2

우리 제품에서 새 데이터베이스를 만들려고 할 때주고 오류가 있습니다. 우리는 오류의 원인이되는 마이그레이션에서 GO 문을 사용하고 있습니다.Entity Framework 마이그레이션에서 GO 문을 실행하는 방법 CodeFirst

System.Data.SqlClient.SqlException (0x80131904) : 다음은 오류가 다음 저장 프로 시저 'GO'

를 찾을 수 없습니다되어 생성 된 마이그레이션 클래스 :

namespace One234C.SRC.DomainModel.ORMapping.Migrations 
{ 
    using System; 
    using System.Data.Entity.Migrations; 

    public partial class AdditionOfBatchCostedFlagColumn : DbMigration 
    { 
     public override void Up() 
     { 
      AddColumn("Service.ServiceOrderComponentDetails", "BatchCostedFlag", c => c.Byte(nullable: true)); 
      Sql("GO"); 
      string queryStr ="UPDATE [Service].ServiceOrderComponentDetails " + 
           "SET BatchCostedFlag = 1"; 
      Sql(queryStr); 
      AlterColumn("Service.ServiceOrderComponentDetails", "BatchCostedFlag", c => c.Byte(nullable: false, defaultValue:0)); 
     } 

     public override void Down() 
     { 
      DropColumn("Service.ServiceOrderComponentDetails", "BatchCostedFlag"); 
     } 

    } 
} 

가 어쨌든 거기 EntityFramework에서 go 문을 사용하지 않고이 작업을 수행하십시오.

+0

http://technet.microsoft.com/en-us/library/ms188037.aspx –

답변

관련 문제