Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void ACLAddTest()
        {
            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";

            BmobACL acl = new BmobACL();

            acl.WriteAccess("b0eab87db3");
            acl.ReadAccess("b0eab87db3");
            data.ACL = acl;

            var future = Bmob.CreateTaskAsync(data);

            FinishedCallback(future.Result, null);
        }
Exemplo n.º 3
0
 /// <summary>
 /// WhereWithinGeoBox查询语法,查询一个矩形范围内的信息
 /// </summary>
 /// <param name="column">字段</param>
 /// <param name="southwest">矩形左下角的坐标点</param>
 /// <param name="northeast">矩形右上角的坐标点 </param>
 /// <returns>返回当前对象</returns>
 public BmobQuery WhereWithinGeoBox(String column, BmobGeoPoint southwest, BmobGeoPoint northeast)
 {
     _where.Composite(column, "$within", new Dictionary <String, object>()
     {
         { "$box", BmobArrays.wrap(southwest, northeast) }
     });
     return(this);
 }
Exemplo n.º 4
0
        private void Create(Action <BmobTable> action)
        {
            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(-100, 100);
            data.s  = "String+String";

            action(data);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Select查询语法,选择指定的列
 /// </summary>
 /// <param name="keys">需要获取的列</param>
 /// <returns>返回当前对象</returns>
 public BmobQuery Select(params String[] keys)
 {
     this.keys = BmobArrays.wrap(keys);
     return(this);
 }