Reputation: 1205
I'm creating an API meant to consume data on an exiting SQL Azure database. I'm creating this API based on ASP.NET's Web API 2.
I'm a complete newbie on this area. This is why I've been following ASP.NET tutorials. I'm able to create a Web API and create models/controllers. But on the database side, every tutorial I come across is about creating a database from the scratch dedicated for the API, not about connecting an existing database that is consumed by the API.
How can I make the connection and query the database from the API?
Tutorials I've followed
Upvotes: 3
Views: 5306
Reputation: 17049
Connection string:
<connectionStrings>
<add name="MyAzzureConnection" connectionString="paste the connection string from Azure here" />
</connectionStrings>
Now you can write your data access code using the technology of your choice, just make sure you use the Azure connection from the Web.config file.
Upvotes: 4