20140419 xamarin zumo
DESCRIPTION
C# で全部書こう!XamarinでZUMO (Azure Mobile Services)TRANSCRIPT
仕事
個人活動
http://bit.ly/metrotokyo4
http://tech.tanaka733.net
Microsoft
• 基本無料プラン
WindowsAzure.MobileServices
PCLとして共通化
• プラットフォームごとのライブラリ
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;
}
ブログ記事
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/TodoItempublic IQueryable<TodoItem> GetAllTodoItems(){
return Query();}
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";
}
}
public class SampleJob : ScheduledJob{
public override Task ExecuteAsync(){
Services.Log.Info("Hello from scheduled job!");return Task.FromResult(true);
}}