How to use Core EF to build Instant Web API

Instant Rest API from your MS SQL database? The biggest advantage of a Restful API is that you don’t have to install anything on the client side (i.e. Your app for example). No SDKs or frameworks are needed nor required. All you have to do is to make a simple HTTP request to the target API service, let the server do the precessing for you and get the result back. Suppose for example, you wanna build a Snapchat clone app. You need for that an image/video processing library, an augmented reality toolkit and an SDK for facial feature extraction. As you may notice, this is time consuming and require a lot of work integrating all the complex libraries into you program.

Benefits of REST Over SOAP. In addition to using HTTP for simplicity, REST offers a number of other benefits over SOAP: REST allows a greater variety of data formats, whereas SOAP only allows XML. Coupled with JSON (which typically works better with data and offers faster parsing), REST is generally considered easier to work with.

Hide Internal Codes: Needless to say, this is an implementation detail that gives away that we are using a relational database, and experienced Oracle users would instantly spot that it’s Oracle’s sample HR schema. This leaking makes it harder to switch to a document-oriented database, like MongoDB, where there is no concept of foreign keys. But even if the chance of switching to MongoDB is zero, it still makes the response harder to read. So a better approach is to let the REST API translate the internal code to the human-readable value that the code represents (i.e. “Shipping Clerk”) and then also remove the Id part of the field name. This version is definitely more readable, but a fair concern is if the service will be slower now that it needs to lookup the value? I used to be an avid reader of Tom Kyte, the Oracle DB expert, and still remember that you should always optimize from measurements. I mean there’s a good chance that the HTTP cache will help us out and make it less of a bottleneck than it appears at first glance. As a rule of thumb, if performance means everything to you (or you have a lot of lookup fields) then you might consider leaking the internal codes. Otherwise, you should provide a more readable API by hiding them.

Use Visual Studio 2017 to create an empty Web API project. Make sure you add unit tests to the solution. This empty solution will be used as a stub for the generated code. Step 2 Run InstantWebAPI application, select the stub Visual Studio solution file (.sln) created in first step. Using a database connection dialog create a connection string to your server. Application supports MS SQL server, Express or Azure. Once a connection is established to the database, select the tables or views for which Web API needs to created and start the code generator. See extra details at Instant Rest API from your MS SQL database.