public virtual bool DeepSave(TransactionManager mgr, Entity entity, DeepSaveType deepSaveType, params Type[] childTypes) { if (entity == null) { throw new ArgumentNullException("entity", "The argument entity, can not be null."); } if (!Enum.IsDefined(typeof(DeepSaveType), deepSaveType)) { throw new ArgumentNullException("A valid DeepSaveType option is not present.", "deepSaveType"); } if (childTypes == null) { throw new ArgumentNullException("childTypes", "A valid Type[] array is not present."); } if (deepSaveType != DeepSaveType.Ignore) { ChildEntityTypesList innerList = new ChildEntityTypesList(); for (int i = 0; i < childTypes.Length; i++) { if (childTypes[i] != null) { if (!childTypes[i].IsGenericType) { innerList.Add(childTypes[i].Name); } else { innerList.Add(string.Format("List<{0}>", childTypes[i].GetGenericArguments()[0].Name)); } } } this.DeepSave(mgr, entity, deepSaveType, childTypes, innerList); } return(true); }
internal virtual bool DeepSave(TransactionManager mgr, TList <Entity> entities, DeepSaveType deepSaveType, Type[] childTypes, ChildEntityTypesList innerList) { if (entities == null) { throw new ArgumentNullException("entityCollection", "A valid non-null, TList<Entity> object is not present."); } if (!Enum.IsDefined(typeof(DeepSaveType), deepSaveType)) { throw new ArgumentException("A valid DeepSaveType option is not present.", "deepSaveType"); } if (childTypes == null) { throw new ArgumentNullException("childTypes", "A valid Type[] array is not present."); } if (deepSaveType == DeepSaveType.Ignore) { return(true); } bool flag = true; if (innerList == null) { innerList = new ChildEntityTypesList(); for (int i = 0; i < childTypes.Length; i++) { if (childTypes[i] != null) { if (!childTypes[i].IsGenericType) { innerList.Add(childTypes[i].Name); } else { innerList.Add(string.Format("List<{0}>", childTypes[i].GetGenericArguments()[0].Name)); } } } } foreach (Entity local in entities) { if (!this.DeepSave(mgr, local, deepSaveType, childTypes, innerList)) { flag = false; } } foreach (Entity local in entities.DeletedItems) { if (!this.DeepSave(mgr, local, deepSaveType, childTypes, innerList)) { flag = false; } } entities.DeletedItems.Clear(); return(flag); }