Reputation: 7669
I want to create stored procedure using Migration Builder but there is no
CreateStoredProcedure
method in Migration class like this.
public override void Up()
{
CreateStoredProcedure(
"MyStoredProcedure",
p => new
{
id = p.Int()
},
@"SELECT some-data FROM my-table WHERE id = @id"
);
}
public override void Down()
{
DropStoredProcedure("MyStoredProcedure");
}
How to Create Stored procedure in Migration using Entity Framework Core?
Upvotes: 9
Views: 2884
Reputation: 41779
Use can use the migrationBuilder.Sql() method to execute arbitrary SQL in migrations with EF Core
Upvotes: 11