我使用Windows Azure构建了一个数据库,目前的目标是使用移动服务在Android应用程序中查询该数据库 .
我构建了一个WCF服务,它给了我想要的结果,然后意识到你可以直接在Azure站点上创建一个移动服务 . 在Azure上创建移动服务并告诉它使用我的Azure数据库后,我没有看到任何地方编写该服务将用于返回数据的查询 . 我还需要我的WCF服务吗?我会以某种方式将其上传到Azure移动服务吗?我可能在这里错过了一些简单的东西 .
检查this . 请参阅"Update the app to use the mobile service for data access"部分 .
private MobileServiceClient mClient; private private MobileServiceTable<ToDoItem> mToDoTable; mClient = new MobileServiceClient("MobileServiceUrl", "AppKey", this) .withFilter(new ProgressFilter()); mToDoTable = mClient.getTable(ToDoItem.class); mToDoTable.where().field("complete").eq(false) .execute(new TableQueryCallback<ToDoItem>() { public void onCompleted(List<ToDoItem> result, int count, Exception exception, ServiceFilterResponse response) { if(exception == null){ mAdapter.clear(); for (ToDoItem item : result) { mAdapter.add(item); } } else { createAndShowDialog(exception, "Error"); } } });
另外,请参阅blog post .
您可能会发现此博文有用:How to use Windows Azure Table Storage in Windows Azure Mobile Services .
这显示了如何使用Windows Azure移动服务在Windows Azure表存储之上构建服务,可以从移动客户端应用程序(Windows Phone,Android,Windows应用商店,iOS或HTML 5)访问该服务 . 您不需要您的WCF服务,您可以在移动服务的 Read 脚本中包含查询 .
此处还有另一个示例,说明如何创建移动服务脚本以访问MongoDB数据库而不是SQL Azure或Windows Azure表存储:http://www.contentmaster.com/azure/using-windows-azure-mobile-services-with-a-mongodb-database/
2 回答
检查this . 请参阅"Update the app to use the mobile service for data access"部分 .
另外,请参阅blog post .
您可能会发现此博文有用:How to use Windows Azure Table Storage in Windows Azure Mobile Services .
这显示了如何使用Windows Azure移动服务在Windows Azure表存储之上构建服务,可以从移动客户端应用程序(Windows Phone,Android,Windows应用商店,iOS或HTML 5)访问该服务 . 您不需要您的WCF服务,您可以在移动服务的 Read 脚本中包含查询 .
此处还有另一个示例,说明如何创建移动服务脚本以访问MongoDB数据库而不是SQL Azure或Windows Azure表存储:http://www.contentmaster.com/azure/using-windows-azure-mobile-services-with-a-mongodb-database/