/// <summary> /// 设置父项 /// </summary> /// <param name="taskTemp">父项</param> private void SetParent(TaskTemp taskTemp) { if (taskTemp == null || taskTemp.IsTransient()) { throw new ArgumentException("任务模板父项参数为空!"); } Parent = taskTemp; ParentId = taskTemp.Id; }
/// <summary> /// 添加子项 /// </summary> /// <param name="taskTemp">子项</param> /// <returns>添加的子项</returns> public TaskTemp AddChild(TaskTemp taskTemp) { if (taskTemp == null || taskTemp.IsTransient()) { throw new ArgumentException("任务模板子项参数为空!"); } Children.Add(taskTemp); taskTemp.SetParent(this); return taskTemp; }