One of the key advantages of using REST Web API as a mode of data
exchange between client-server machines is that it can connect any type
to a data source, and client machines do not need to bother about it.
Depending on the business requirements, any sort of database; e.g. SQL
server, MySQL, CSV files, Excel file etc., can be connected with the
underlying development platform to exchange data with the client
machines.
Today, I shall be
demonstrating the creation of a REST Web API connection with SQL server Entity
Framework Database First approach using ASP.NET REST Web API platform.

Prerequisites
Following are some prerequisites before you proceed any further in this tutorial.
- Knowledge of REST Web API.
- Knowledge of ASP.NET MVC5.
- Knowledge of C# Programming.
The example code is
being developed in Microsoft Visual Studio 2019 Professional. I have taken the data sample from AdventureWorks for SQL server 2014.
Let's begin now.
Step 1
Create new Web API project and name it "RESTWebApiGetMethod".
Step 2
Although you can create your entity framework model inside any hierarchy of the project, I prefer "Models" folder, to keep code cleaner. So, right click on your "Models" folder and then click "Add->ADO.NET Entity Data Model" as shown below i.e.

Step 3
Now, from "Entity Data Model Wizard" choose "EF Designer from database", since I am creating entity framework database first approach model. Then click "Next" as shown below i.e.

Step 4
On the "Choose Your Data Connection" window, click "New Connection" button and create your SQL server connection as shown below i.e.:

Step 5
Now, on "Choose Your Data Connection" window, click "Yes, include sensitive data in connection string" option and click "Next" as shown below i.e.:




هشام حمدىPosted Apr 20, 2021, 1:32 AM
Response return null