0

I have a number of tables inside a database that I use for 4-5 different websites. These tables already exist and have plenty of data and views/stored procedures/functions etc. already completed.

I would like to provide an api to give access to each of these tables to whichever website I happen to be using so they're accessing the data in a consistent manner. I have Visual Studio 2015 and have been trying to create a Web Api using EntityFramework.

However, every tutorial I find for accessing databases insists on creating the database and tables within the code for the api, and utilizes just the tables with the various CRUD actions handled within.

As I have the tables built, I don't want to recreate them, and as I have some programming already in place using functions/stored procs, I don't really want to reinvent the wheel and recreate it all.

I did find this: http://www.c-sharpcorner.com/UploadFile/4b0136/working-with-stored-procedures-using-entity-framework-part/ for EF6 (though I believe I'm using EF7, but that seems to be importing each function in turn, which seems.. kludgy)

So my question is two-fold:

  1. Is ASP.NET 5 web api the right tool for the job?
  2. Can the ASP.NET 5 web api handle stored procedures easily?
2
  • EF can work with your existing table structure, you don't have to create new tables. This tech stack will certainly handle this type of thing. Whether it's the best choice is off topic for SO. Commented Feb 15, 2016 at 23:46
  • Thanks Eric - will it also handle using the stored procedures already in place, or do they need to be either imported (as in the link provided) or reimplemented via code in the web api? Commented Feb 15, 2016 at 23:48

1 Answer 1

1

At time of writing it's currently easier to build an API over an existing database using ASP.NET 4.6 and EF 6. This tutorial describes how you can go about building a model from an existing database:

http://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application

Once you have a model and your classes in place, you can then follow any article on scaffolding Web API.

Sign up to request clarification or add additional context in comments.

1 Comment

Perfect, thanks. I'll try going back to 4.6 and EF6 and try again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.