TableController vs ApiController in Azure Mobile Apps
Asked Answered
M

1

10

I'm just getting started with Mobile Apps. I'm used to making APIs with ApiController of Web API.

The default project template for Mobile Apps in VS2015 comes with a sample TodoItemController that inherits from TableController. It looks like there are some CRUD operations installed out-of-the-box in TableController and each data object must be of type ITableData.

Ideally, I'd like to skip TableController and implement things my own way with ApiController.

My question is, what are the ramifications of ditching TableController if any? Is there any tight-coupling between App Service and the use of TableController?

Megan answered 7/10, 2015 at 3:7 Comment(2)
Do you mind sharing what aspects of ITableData aren't ideal? In the future, we may relax some of these requirements.Macdougall
non-nullable guid for the Id column and non-nullable datesMegan
J
7

The TableController is coupled with the client SDK's table logic, and provides all the right logic & columns for the interactions needed for querying, offline sync, etc.

You can use API Controllers just fine, it mainly will depend on what features you want to use.

Jocosity answered 7/10, 2015 at 15:53 Comment(6)
Can those features be implemented with ApiController?Megan
No, if you want offline sync and client-side querying capabilities, you need to use a TableController. All other features will work fine with ApiController. Make sure you use the attribute MobileAppController, see azure.microsoft.com/en-us/documentation/articles/…Macdougall
@lindydonna-msft what is the advantage of using MobileAppController if I only want to return json object?Pochard
@batmaci MobileAppController will set up JSON serializers in a way that is compatible with the Mobile Apps client SDKs.Macdougall
Don't use it, it is a bad idea. The TableController is not worth the effort and you will eventually dump it. To add to this MS philosophy when they can't fix something, they create something new and expect you to follow.Reformation
Managing your own api sync is very easy using shinyReformation

© 2022 - 2024 — McMap. All rights reserved.