Example #1
0
        /// <summary>
        /// 实现 {column: {key: value}} 的效果
        /// </summary>
        internal static void Composite(IDictionary data, String column, String key, Object value)
        {
            var part = data[column];

            if (part == null || !(part is IDictionary))
            {
                // !!SimpleJson处理Dictionary<string, Object>才正常
                part = new Dictionary <String, Object>();
            }
            ((IDictionary)part).Add(key, value);

            BmobOutput.Save(data, column, part);
        }
Example #2
0
        public override void write(BmobOutput output, bool all)
        {
            base.write(output, all);

            var requests = new List <IDictionary>();

            foreach (BmobInteractObject req in BmobWrapper.Requests)
            {
                String method = req.Method;
                if (method == null)
                {
                    continue;
                }

                // XXX 1.6 根据restful接口优化
                String path = "";
                if (method.Equals("POST"))
                {
                    path = "/1/classes/" + req.Table;
                }
                else if (method.Equals("DELETE") || method.Equals("PUT"))
                {
                    path = "/1/classes/" + req.Table + "/" + req.ObjectId;
                }

                IDictionary one = new Dictionary <String, Object>();

                BmobOutput.Save(one, "method", method);
                if (BmobUser.CurrentUser != null)
                {
                    BmobOutput.Save(one, "token", BmobUser.CurrentUser.sessionToken);
                }
                BmobOutput.Save(one, "path", path);
                BmobOutput.Save(one, "body", req.Data);
                requests.Add(one);
            }

            output.Put("requests", requests);
        }
Example #3
0
 public Where EqualTo(String column, object value)
 {
     BmobOutput.Save(real, column, value); return(this);
 }
Example #4
0
 internal IBmobOperator handle(String column, Operate op)
 {
     BmobOutput.Save(operates, column, op);
     return(this);
 }