Last post Mar 03, 2015 01:32 AM by Shawn - MSFT
Mar 02, 2015 10:00 AM|DavidinUSA|LINK
I am trying to design RESTful WEB API that can access database (e.g. SQL server) so that I can get data from the database and do some calculations locally and then put the results back to the database.
I am working in C# VS 2013.
I found some examples of ASP.NET API at
I need to access database (that is located in remote server) from ApiController.
But, in the exmaples, the database is built locally.
Also, I need to access the remote database server from a GUI.
The GUI users should not see any information about login to the database server, such as password and username.
They can only see the server name and database names.
Any help would be appreciated.
Mar 02, 2015 10:07 AM|AidyF|LINK
Go through some tutorials on Entity Framework (especially "database first" tutorials) and they'll show you how you access an explicit database. You just need to ensure the connection string you use points to the remote server you're using.
Mar 03, 2015 01:32 AM|Shawn - MSFT|LINK
For this situation, if you want to connect to the database in web api, you just need know the database server name, database name, user name and password etc. You can connect the remote database within your web api application, then the GUI users can only
invoke the web api method to finish the operations, and the information about the database server would not be exposed.
You may refer to the following links for more information about using Entity Framework: