在Azure Azure服务中使用SQL Server视图 [英] Use SQL Server view in NEW Azure App Service

查看:218
本文介绍了在Azure Azure服务中使用SQL Server视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Azure应用服务的新手。

I am new to Azure App Service.

我在Azure数据库中创建了一个视图,以跨多个表获取数据。现在,我想使用Azure移动服务(MobileService.GetTable ...)在我的Cordova应用程序中使用此视图的数据。我在网上找到了几篇文章,描述如何在经典Azure门户中做到这一点。但是我需要一个解决方案来使用Node.js后端的新Azure应用程序服务。

I've created a view in Azure database to get data across several tables. Now I want to use the data from this view in my Cordova App using the Azure Mobile Service (MobileService.GetTable...). I found several articles in the web that describe how to do that in Classic Azure Portal. But I need a solution for the NEW Azure App Service with Node.js Backend.

从Azure视图返回数据的语法是什么?

What is the syntax to return data from a view as an Azure table?

var table = module.exports = require('azure-mobile-apps').table();
table.read(function (context) {
// *** Need code to return data from sql view ***
//return context.execute();
});

在返回之前使用参数过滤视图中的数据是非常好的。

And it would be great to use a parameter to filter data in the view before returning.

感谢,
Uwe

Thanks, Uwe

推荐答案

。您只需创建一个表控制器来访问视图。确保您定义了系统列(版本,updatedAt,createdAt,已删除和id)。另外,确保在更新视图时发生正确的事情(例如使用INSERT,UPDATE,DELETE),因为这将告诉您需要对控制器执行什么操作(例如,如果无法插入/更新/删除,

You are pretty much right there. You need to just create a table controller to access the view. Ensure you have the system columns defined (version, updatedAt, createdAt, deleted and id). Also, ensure the right thing happens when you update the view (e.g. with an INSERT, UPDATE, DELETE) as that will tell you what needs to be done with the controller (for example, if you can't insert/update/delete, then make it read-only).

参考博客文章: https://shellmonger.com/2016/04/15/30-days-of -zumo-v2-azure-mobile-apps-day-8-table-controller-basics /

这篇关于在Azure Azure服务中使用SQL Server视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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