Large object loading
Large objects specific properties Lob and Xml specially used to lazy access to potentially big sized data stored in database.
When data object accessed using XData, large objects data not queried, but replaced with null values to create full structure of object.
To get or set value of Lob or Xml Lob.Value and Xml.Document properties are used. Size of Lob can be checked using GetSize method.
To simplify value assigning overrided operation += can be used as described in example below:
obj.Source += new XDocument(new XElement("invoice", new XAttribute("number", number), new XAttribute("state", z.DocStateCode)));
obj.Scan += Encoding.UTF8.GetBytes(z.Source.Document.ToString());
To modify value of large objects in LINQ styled sequence of command helper methods Modify(Xml, Action<XDocument>) and Modify(Lob, Action<Byte[]>) can be used like in example below:
invoice.Modify(
z => z.DocState += dataScope.GetDictionaryValue<DocState>(x => x.Code == newStateCode),
z => z.Source.Modify(doc => doc.Element("invoice").Attribute("state").Value = newStateCode))
.Submit();
Warning
When object is serialized large objects properties are serialized with null values by default! When actual value of large object is required it must to be requested separately. To fill object large properties before serialization can be used one of LoadLob or LoadLobAsync helper method overloads.