How to execute GO statement in Entity Framework Migrations CodeFirst
when we try to create a new database from our product is gives and error
in mirgrations. We are using GO statement in the migrations which is
causing the error. Following is the error:
System.Data.SqlClient.SqlException (0x80131904): Could not find stored
procedure 'GO'
Following is the migration class created :
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");
}
}
}
Is there anyway to do this operation without using go statement in
EntityFramework.
No comments:
Post a Comment