且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Xamarin应用程序连接到SQL Azure DB

更新时间:2022-02-28 10:13:05

答案

您需要创建一个Azure API应用. Xamarin应用程序将使用此REST API与数据库进行交互.

Answer

You'll need to create an Azure API App. The Xamarin app will use this REST API to interact with the database.

永远不要使用数据库的connection string将移动应用程序直接连接到远程数据库,因为这样可能会破坏数据库.例如,如果移动应用程序用户的互联网连接较差,并且他们直接连接到数据库,则该应用程序可能无法完成执行数据库查询. API将确保不会因互联网连接不佳而导致数据库损坏.

Never connect a mobile app directly to a remote database using the database's connection string, because this opens up the potential for database corruption. For example, if the mobile app user has a poor internet connection, and they are connecting directly to the database, the app may not be able to finish executing a database query. An API will ensure that no database corruption happens due to a poor internet connection.

我有一个示例应用程序和一个演练,其中显示了如何创建Azure API应用程序,如何将其连接到Azure SQL数据库以及如何使移动应用程序与REST API通信.

I have a sample app and a walkthrough here that shows how to create an Azure API App, connect it to an Azure SQL Database and how to have the mobile app communicate with the REST API.

https://github.com/brminnick/XamList