如何将 Azure 移动应用服务与现有 SQL 数据库一起使用 [英] How to use Azure Mobile App service with existing SQL database

查看:33
本文介绍了如何将 Azure 移动应用服务与现有 SQL 数据库一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了许多演示如何使用 Azure 移动服务的文章和教程,但是我对很多事情都不清楚.

I've read many articles and tutorials that demonstrate how to use the Azure mobile service however I'm left unclear with many things.

我有一个使用 Azure SQL 数据库并随 Azure 发布的现有 Web 应用程序.我正在尝试将已经创建的数据库集成到我正在开发的 Xamarin Android 应用程序中.

I have an existing web app that uses Azure SQL database and is published with Azure. I'm trying to integrate the already created database into the Xamarin Android App I'm developing.

我对以下事情感到困惑.

I'm confused with the following things.

  1. 我是否需要更改 .Net 后端才能使用 Xamarin 应用程序中的数据库表?在我看来,我不需要这样做,因为 Xamarin 应用程序与 SQL 数据库通信,而不是 .Net 应用程序.

  1. Do I need to change the .Net back end to be able to use the database tables in the Xamarin app? The way I see it, I shouldn't need to since the Xamarin app communicates with the SQL database, not the .Net app.

数据如何存储到 SQL 表中?我是否只是在我的 Xamarin 应用程序中引用移动服务,它将在 SQL 数据库和我的应用程序之间建立一座桥梁,还是我需要先创建表或从数据库中导入现有表?

How does the data get stored into the SQL table? Do I just reference the Mobile service inside my Xamarin app and it will create a bridge between the SQL database and my application or do I need to first create the tables or import the existing tables from the database?

Web 应用当前已部署到 Azure Web 服务.需要部署到Mobile App服务吗?

The web app is currently deployed to Azure Web service. Does it need to be deployed to Mobile App service?

如果有人能帮助我解决这些问题,我将不胜感激.

I would really appreciate if someone can help me out with these questions.

推荐答案

您的移动应用程序没有直接与您的 SQL 数据库通信.它可能通过 Azure 应用服务 - 这是一个支持 Web 的中间件,可将 SQL 数据库中的表投影到 OData 源.因此,您拥有三部分 - SQL 数据库、Azure 应用服务和您的客户端.

Your mobile app is not communicating directly with your SQL database. It is likely going through an Azure App Service - this is a web-enabled piece of middleware that projects tables within the SQL database to an OData feed. So you have three pieces - the SQL database, the Azure App Service and your client.

1) 是的,您需要更新 ASP.NET 后端以支持您的数据库表.如果这是一个现有的数据库,那么您还需要更新您的数据库以支持移动投影.我为此写了一篇博客:https://shellmonger.com/2016/05/11/30-days-of-zumo-v2-azure-mobile-apps-day-19-asp-net-table-controllers/ 但您可能希望在该系列的早期开始.

1) Yes, you need to update the ASP.NET backend to support your database tables. If this is an existing database, then you also need to update your database to support the mobile projection. I wrote a blog on this: https://shellmonger.com/2016/05/11/30-days-of-zumo-v2-azure-mobile-apps-day-19-asp-net-table-controllers/ but you may want to start earlier in the series that that.

2) 将 Azure 移动客户端添加到 Xamarin 应用程序 - 这会协调客户端和后端之间的数据传输.您可以在此处找到我推荐的教程:https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-android-get-started/ - 你也可以阅读如何在这里:https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-dotnet-how-to-use-client-library/ - 本教程和 HOWTO 涵盖离线和在线数据访问场景.

2) You add the Azure Mobile client to your Xamarin app - this coordinates the transfer of data between your client and the backend. You can find a tutorial on this that I recommend walking through here: https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-android-get-started/ - you can also read the HOWTO here: https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-dotnet-how-to-use-client-library/ - the tutorial and HOWTO cover both offline and online data access scenarios.

3) 如果您使用的是新门户 (portal.azure.com),那么移动应用程序和 Web 应用程序之间确实没有区别.移动应用程序只是一个 Web 应用程序,具有部署在您的 ASP.NET(或 Node.js)后端代码中的特定 SDK 并具有连接的数据库.细微的区别是,如果您创建一个移动应用程序,然后单击 Quickstarts(在设置中)将为您提供移动快速启动;如果您对 Web 应用程序执行相同操作,则单击 Quickstarts 将使您获得 Web 快速启动.

3) If you are using the new portal (portal.azure.com), then there is really no difference between a Mobile App and a Web App. The Mobile App is simply a web app with a specific SDK deployed within your ASP.NET (or Node.js) backend code and with a connected database. The minor difference is that if you create a Mobile App then clicking on Quickstarts (within Settings) will get you a mobile quick start; if you do the same with a Web App, then clicking on Quickstarts will get you a web quick start.

这篇关于如何将 Azure 移动应用服务与现有 SQL 数据库一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆