TableController类的用途是什么?在哪里使用其方法? [英] What is the TableController class for and where are its methods used?

查看:107
本文介绍了TableController类的用途是什么?在哪里使用其方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用Azure,并选择在VS中使用.NET设置移动服务.我一直在学习Azure Todo入门服务器项目的组成部分.

I've been starting out with Azure and have chosen to set up a Mobile Service using .NET in VS. I've been learning about the constituents of the Azure Todo get-started server project.

我想了解的一件事(即使使用广泛的Googling)是TableController方法的用途吗?我了解TableController将表暴露给HTTP请求吗?但是,当我从客户端访问数据时,我在MobileServiceClient实例返回的表上使用".LookupAsync"或".UpdateAsync"方法.

One thing I'm struggling to understand (even with extensive Googling) is what the TableController methods are for? I understand that TableController exposes the table to HTTP requests? But when I access data from my client I'm using ".LookupAsync" or ".UpdateAsync" methods on the Table returned by my MobileServiceClient instance.

TableController中的GetAllToDoItems(..),PathToDoItem(..),GetToDoItem(..),PostToDoItem(..),DeleteToDoItem(..)方法是否在我进行这些调用时在幕后某个地方使用MobileServiceClient表?

Are the GetAllToDoItems(..), PathToDoItem(..), GetToDoItem(..), PostToDoItem(..), DeleteToDoItem(..) methods in the TableController being used behind the scenes somewhere when I make those calls on the MobileServiceClient Table?

我可以从客户端访问那些方法吗?这些方法是标准/必需的方法名称吗?

Can I access those methods from my client? Are these methods standard/required method names?

TableController是放置服务器代码进行授权的好地方吗?例如.仅返回该用户记录的经典示例?

Is TableController a good place to put server code for authorisation? E.g. the classic example of only returning that user's records?

感谢您的帮助, 汤姆.

Thanks for any help, Tom.

推荐答案

我可以从客户端访问那些方法吗?这些方法是标准/必需的方法名称吗?

Can I access those methods from my client? Are these methods standard/required method names?

当前,Azure移动应用程序支持C#和node.js作为其后端语言.从入门文章,我们知道无论您是在构建本机iOS,Android和Windows应用程序还是跨平台Xamarin或Cordova(Phonegap)应用程序,我们都可以使用本机SDK来利用移动应用程序.我们可以在后端项目中看到很多功能,例如GetAllToDoItems(..),PathToDoItem(..),GetToDoItem(..),PostToDoItem(..),DeleteToDoItem(..).此方法是MVC控制器动作名称.请注意,SDK函数非常重要,正如我们在下面看到的那样,后端项目具有一个名为GetTodoItem的函数.

At currently, Azure mobile app support C# and node.js as its backend language. From the Get started article, we can know that we can take advantage of Mobile App using native SDKs whether you're building native iOS, Android, and Windows apps or cross-platform Xamarin or Cordova (Phonegap) apps. We can see a lot of functions like GetAllToDoItems(..), PathToDoItem(..), GetToDoItem(..), PostToDoItem(..), DeleteToDoItem(..) in the backend project. This method is a MVC controller action name. Please note the SDK functions are the important, as we can see below, the backend project has a function called GetTodoItem.

     public SingleResult<TodoItem> GetTodoItem(string id)
        {
            return Lookup(id);
        }

但是在名称空间"Microsoft.Azure.Mobile.Server"下的功能Lookup是此功能的关键方法:

However the function Lookup which under the namespace "Microsoft.Azure.Mobile.Server" is the key method in this function:

TableController是放置服务器代码进行授权的好地方吗?例如.仅返回该用户记录的经典示例?

Is TableController a good place to put server code for authorisation? E.g. the classic example of only returning that user's records?

如果您想添加身份验证,我认为

If you want to add authentication, I think this article may be give you helps. Just use Azure AD for example, if you want to protect some table controller, we only need to configure Azure AD then add [Authorize] attribute before table controller, it is not necessary to add authrize code in that table controller.

这篇关于TableController类的用途是什么?在哪里使用其方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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