Hi all,
I am trying to persist the collection of child elements, the solution works but I would like to ask the more experienced people if the approach is the right one?
public bool InsertNewActionHistory(ActionHistory actionHistory)
{
bool result = false;
using (TransactionScope transactionScope = new TransactionScope())
{
this.ActionHistories.AddObject(actionHistory);
if (actionHistory is ActionUpdate)
{
foreach (ActionUpdateDetail updateDetail in ((ActionUpdate)actionHistory).ActionUpdateDetails)
{
ActionUpdateDetails.AddObject(updateDetail);
}
}
this.CommitChanges();
transactionScope.Complete();
result = true;
}
return result;
}