Stored procedure in Entity Framework Core 5

Viewed 303

I want to use a stored procedure with join in Entity Framework Core 5. I have created the stored procedure using code-first migration.

How can I retrieve data from non-entity type that the stored procedure returns, and then display in view?

1 Answers
[HttpPost]
    public async Task<ActionResult<IEnumerable<output>>> Getoutput(Input input)
    {
        string StoredProc = "exec YourStoreProcedure " +
                "@Id= '" + input.Id+ "'";

        return await _context.output.FromSqlRaw(StoredProc).ToListAsync();
    }
Related