0

I have a stored procedure already in the database, I create an Entity Data Model, select the stored procedure, import into entity model is selected. After creation go to model browser, double click on stored procedure under Function Imports and update complex types. Everything seems fine.

Right click folder, add new scaffolding, select SP under Model Class, click add and get the following error:

enter image description here

Is scaffolding available with stored procedures? If so, what is missing?

Thanks!!

Diomedes
  • 634
  • 11
  • 24

1 Answers1

0

Here is what you can do :

  1. Add a empty 2.0 web api controller
  2. Add using YourProjectName.Models
  3. Add this code for your newly created controller.

    public IHttpActionResult Get(string Id)
    {
        dbEntities db = new dbdbEntities();
        var record = db.sp_yourStoreProcedure(Id);
    
        if (record == null)
        {
            return NotFound();
        }
    
        return Ok(record);
    }
    
    1. Run and test with http://localhost:{port}/api/{controller}/{id}

*{controller}: controller name without the 'controller' part RepresasController = Represas

mmttato
  • 573
  • 6
  • 8