public void BatchTest() { var data = new GameObject(TABLENAME); data.arrint = BmobArrays.wrap <int>(1, 2, 3); data.arrstring = BmobArrays.wrap <string>("1", "2", "3"); data.jo2 = 123; // 用于下面的区间查询 Random rnd = new Random(); data.jo = rnd.Next(-50, 170); data.s = "String"; var reqs = new BmobBatch().Create(data); var future = Bmob.BatchTaskAsync(reqs); //{"data":[{"success":{"createdAt":"2014-08-23 08:00:38","objectId":"6fcb5d0eab"}},{"success":{"createdAt":"2014-08-23 08:00:38","objectId":"2d626312e3"}}],"result":{"code":200,"message":"ok"}} //{"data":[{"error":{"code":105,"error":"It is a reserved field: objectId."}},{"error":{"code":105,"error":"It is a reserved field: objectId."}}],"result":{"code":200,"message":"ok"}} //{"data":[{"error":{"code":105,"error":"It is a reserved field: objectId."}}],"result":{"code":200,"message":"ok"}} // TODO 处理返回值 FinishedCallback(future.Result, null); }
public void Batch(BmobBatch requests, BmobCallback <List <Dictionary <String, Object> > > callback) { var bia = BmobInteractObject.Batch; bia.Data = requests; submit(bia, callback); }
public void BatchCreate500Test() { var b = new BmobBatch(); for (var i = 1; i < 500; i++) { Create( data => { b.Create(data); } ); if (i % 50 == 0) { var future = Bmob.BatchTaskAsync(b); FinishedCallback(future.Result, null); b = new BmobBatch(); } } }
// / @see TEST#GenCode public Task <List <Dictionary <String, Object> > > BatchTaskAsync(BmobBatch requests) { return(ExecuteTaskAsync <List <Dictionary <String, Object> > >(callback => { Batch(requests, callback); }, CancellationToken.None)); }
public void BatchTest() { var data = new GameObject(TABLENAME); data.arrint = BmobArrays.wrap<int>(1, 2, 3); data.arrstring = BmobArrays.wrap<string>("1", "2", "3"); data.jo2 = 123; // 用于下面的区间查询 Random rnd = new Random(); data.jo = rnd.Next(-50, 170); data.s = "String"; var reqs = new BmobBatch().Create(data); var future = Bmob.BatchTaskAsync(reqs); //{"data":[{"success":{"createdAt":"2014-08-23 08:00:38","objectId":"6fcb5d0eab"}},{"success":{"createdAt":"2014-08-23 08:00:38","objectId":"2d626312e3"}}],"result":{"code":200,"message":"ok"}} //{"data":[{"error":{"code":105,"error":"It is a reserved field: objectId."}},{"error":{"code":105,"error":"It is a reserved field: objectId."}}],"result":{"code":200,"message":"ok"}} //{"data":[{"error":{"code":105,"error":"It is a reserved field: objectId."}}],"result":{"code":200,"message":"ok"}} // TODO 处理返回值 FinishedCallback(future.Result, null); }