12. public static MobileServiceClient MobileService = new MobileServiceClient(
"https://xamarinazure.azure-mobile.net/",
“HogeMogeApplcationKey"
);
private async Task TestAsync()
{
var res = await MobileService.InvokeApiAsync<string>("test");
// textBox.Text = res;
}
13.
14.
15. ブログ記事
public class TodoItemController : TableController<TodoItem>
{
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
var context = new XamarinAzureServiceContext(Services.Settings.Schema);
DomainManager = new EntityDomainManager<TodoItem>(context, Request, Services);
}
// GET tables/TodoItem
public IQueryable<TodoItem> GetAllTodoItems()
{
return Query();
}
16. AuthorizeLevel 属性で認証レベルを制御
public class TestController : ApiController
{
public ApiServices Services { get; set; }
// GET api/Test
[AuthorizeLevel(AuthorizationLevel.Anonymous)]
public string Get()
{
Services.Log.Info("Hello from custom controller!");
return "Hello";
}
}
17. public class SampleJob : ScheduledJob
{
public override Task ExecuteAsync()
{
Services.Log.Info("Hello from scheduled job!");
return Task.FromResult(true);
}
}