static bool CreateChildren(XTypedObject parent, XTypedObject.Initializer parentConfig) { SimpleServiceContainer cChild = null; List <XTypedObject> created = null; XTypedFactory typeFactory = null; var eParent = parent.XElement; foreach (var child in eParent.Elements()) { if (typeFactory == null) { typeFactory = parentConfig.ChildServices.GetService <XTypedFactory>(true); } var rChild = parentConfig.Reader.WithElement(child, false); var tChild = typeFactory.GetMappping(rChild); if (tChild != null) { if (cChild == null) { cChild = new SimpleServiceContainer(parentConfig.ChildServices); } var config = new XTypedObject.Initializer(parent, rChild, cChild); var o = (XTypedObject)cChild.SimpleObjectCreate(rChild.Monitor, tChild, config); if (created == null) { created = new List <XTypedObject>(); } created.Add(o); if (o == null || !CreateChildren(o, config)) { return(false); } rChild.WarnUnhandledAttributes(); } } return(parent.OnChildrenCreated(parentConfig, (IReadOnlyList <XTypedObject>)created ?? Array.Empty <XTypedObject>())); }