public async Task Fetch() { LCObject hello = LCObject.CreateWithoutData("Hello", "5e14392743c257006fb769d5"); await hello.Fetch(includes : new List <string> { "objectValue" }); LCObject world = hello["objectValue"] as LCObject; TestContext.WriteLine(world["content"]); Assert.AreEqual(world["content"], "7788"); }
public async Task FetchAll() { LCQuery <LCObject> query = new LCQuery <LCObject>("Hello"); IEnumerable <string> ids = (await query.Find()).Select(obj => obj.ObjectId); IEnumerable <LCObject> list = ids.Select(id => LCObject.CreateWithoutData("Hello", id)); await LCObject.FetchAll(list); Assert.Greater(list.Count(), 0); foreach (LCObject obj in list) { Assert.NotNull(obj.CreatedAt); } }
public async Task Fetch() { Hello hello = new Hello { World = new World { Content = "7788" } }; await hello.Save(); hello = LCObject.CreateWithoutData("Hello", hello.ObjectId) as Hello; await hello.Fetch(includes : new string[] { "objectValue" }); World world = hello.World; WriteLine(world.Content); Assert.AreEqual(world.Content, "7788"); }
internal override void Decode(Dictionary <string, object> msgData) { base.Decode(msgData); if (msgData.TryGetValue(MessageFileKey, out object fileDataObject)) { Dictionary <string, object> fileData = fileDataObject as Dictionary <string, object>; if (fileData == null) { return; } if (fileData.TryGetValue(MessageDataObjectIdKey, out object objectIdObject)) { string objectId = objectIdObject as string; File = LCObject.CreateWithoutData(LCFile.CLASS_NAME, objectId) as LCFile; if (fileData.TryGetValue(MessageDataUrlKey, out object url)) { File.Url = url as string; } if (fileData.TryGetValue(MessageDataMetaDataKey, out object metaData)) { File.MetaData = metaData as Dictionary <string, object>; if (File.MetaData == null) { return; } if (File.MetaData.TryGetValue(MessageDataMetaNameKey, out object name)) { File.Name = name as string; } if (File.MetaData.TryGetValue(MessageDataMetaSizeKey, out object size) && int.TryParse(size as string, out int s)) { Size = s; } if (File.MetaData.TryGetValue(MessageDataMetaFormatKey, out object format)) { Format = format as string; } } } } }