/// <summary> /// Update the <see cref="ThingTransaction"/> with new <see cref="ParameterSubscription"/>s /// </summary> /// <param name="transaction"> /// The subject <see cref="IThingTransaction"/> that is to be updated /// </param> /// <param name="owner"> /// The <see cref="DomainOfExpertise"/> that is be the owner of the created <see cref="ParameterSubscription"/>s and should therefore /// not be the owner of the <see cref="Parameter"/>s or <see cref="ParameterOverride"/>s that are subscribed to /// </param> /// <param name="parameterOrOverrides"> /// An <see cref="IEnumerable{ParameterOrOverrideBase}"/> for which new <see cref="ParameterSubscription"/>s will be created. /// </param> private void UpdateTransactionWithUpdatedParameters(IThingTransaction transaction, ActualFiniteStateList actualFiniteStateList, IEnumerable <Parameter> parameters) { foreach (var parameter in parameters) { var clone = parameter.Clone(false); clone.StateDependence = actualFiniteStateList; transaction.CreateOrUpdate(clone); } }
/// <summary> /// Update the <see cref="ThingTransaction"/> with updated <see cref="IOwnedThing"/>s /// </summary> /// <param name="transaction"> /// The subject <see cref="IThingTransaction"/> that is to be updated /// </param> /// <param name="ownedThings"> /// The <see cref="IEnumerable{IOwnedThing}"/> whose ownership needs to be updated /// </param> /// <param name="owner"> /// The <see cref="DomainOfExpertise"/> that is be the owner of the updated <see cref="IOwnedThing"/>s /// </param> private void UpdateTransactionWithUpdatedOwners(IThingTransaction transaction, IEnumerable <IOwnedThing> ownedThings, DomainOfExpertise owner) { foreach (var ownedThing in ownedThings) { var clone = ((Thing)ownedThing).Clone(false); var clonedOwnedThing = (IOwnedThing)clone; clonedOwnedThing.Owner = owner; transaction.CreateOrUpdate(clone); } }