Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Fixed incomplete deep copy of projects
Browse files Browse the repository at this point in the history
  • Loading branch information
seb-eis committed Nov 3, 2020
1 parent 4a0ba55 commit 677b763
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ protected void DuplicateProject(MocassinProject project)
projectCopy.JobSetTemplates.Clear();
projectCopy.SimulationDbBuildTemplates.Clear();
}
else
{
foreach (var item in projectCopy.CustomizationTemplates.Cast<ProjectChildEntity<MocassinProject>>()
.Concat(projectCopy.JobSetTemplates).Concat(projectCopy.SimulationDbBuildTemplates)) item.Parent = projectCopy;
}

ExecuteOnAppThread(() => MocassinProjects.Add(projectCopy));
PushInfoMessage($"Project {project.ProjectName} (ID = {project.ProjectGuid}) was copied.");
Expand Down
8 changes: 8 additions & 0 deletions src/ModelBuilder/Mocassin.UI.Xml/Main/MocassinProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ public static MocassinProject CreateNew()
return project;
}

/// <inheritdoc />
public override ProjectDataObject DeepCopy(PreserveReferencesHandling referencesHandling = PreserveReferencesHandling.All)
{
var copy = (MocassinProject) base.DeepCopy(referencesHandling);
copy.RestoreParentReferences();
return copy;
}


/// <inheritdoc />
public override void FromJson(string json, JsonSerializerSettings serializerSettings = null)
Expand Down

0 comments on commit 677b763

Please sign in to comment.