Radenko Zec
Radenko Zec

Reputation: 7669

No CreateStoredProcedure method on Entity Framework Core

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

Answers (1)

ErikEJ
ErikEJ

Reputation: 41779

Use can use the migrationBuilder.Sql() method to execute arbitrary SQL in migrations with EF Core

Upvotes: 11

Related Questions