c# - How can I update object that contains other objects in lists with npoco? -
I have a class with some properties in which it has a list with other class objects. [Classname ("ITIMID", auto increment = false)] [explanatory columns] public class item {[column ("ITIMID")] Public Gide Id (get; set;) [column ("ITM_name")] public string name {get; set;} public list & lt; picturelink & gt; picturelink {get; set;}} [tagalname ("TBL picture line Link ")] [primary (" PIILID ", automatic incarimmment = false)] [clear column] Public String InformationType {get; set;}}
P> I want to update with npoco like db.Update (item) - but then only the property ID and name is updated, how can I update the list with picture links in the same statement?
Update for child object Add to loop:
using (var scope = db.gettraination ()) {db.Update (item); Forash (links in various photo items, picture links) {db.Update (pictureLink); } Scope.Complete (); }
Adding an update to the transaction, if something goes wrong, then a rollback will ensure.
Comments
Post a Comment