public NCMBObject Set(string key, NCMBRelation value) { if (_objects.ContainsKey(key)) { _objects.Remove(key); } _objects.Add(key, value); return(this); }
public async new Task <bool> Save() { var relation = new NCMBRelation(); if (__op == "AddUser" || __op == "AddRole") { foreach (var user in users) { relation.Add((NCMBUser)user); } foreach (var role in roles) { relation.Add((NCMBRole)role); } } if (__op == "RemoveUser" || __op == "RemoveRole") { foreach (var user in users) { relation.Remove((NCMBUser)user); } foreach (var role in roles) { relation.Remove((NCMBRole)role); } } if (__op == "AddUser" || __op == "RemoveUser") { this.Set("belongUser", relation); } if (__op == "AddRole" || __op == "RemoveRole") { this.Set("belongRole", relation); } if (users.Count == 0) { this._fields.Remove("belongUser"); } if (roles.Count == 0) { this._fields.Remove("belongRole"); } await base.Save(); return(true); }