public NotMatchingChildrenListName_Child(NotMatchingChildrenListName_Child original) { #pragma warning restore CS8618 // Key = StorageExtensions.NoKey; Text = original.Text; Parent = original.Parent; onCloned(this); }
public void Update(string text, NotMatchingChildrenListName_Parent parent) { if (Key >= 0) { if (parent.Key < 0) { throw new Exception($"NotMatchingChildrenListName_Child.Update(): It is illegal to add stored NotMatchingChildrenListName_Child '{this}'" + Environment.NewLine + $"to Parent '{parent}', which is not stored."); } } var clone = new NotMatchingChildrenListName_Child(this); var isCancelled = false; onUpdating(text, parent, ref isCancelled); if (isCancelled) { return; } #if DEBUG DC.Trace?.Invoke($"Updating NotMatchingChildrenListName_Child: {ToTraceString()}"); #endif var isChangeDetected = false; if (Text != text) { Text = text; isChangeDetected = true; } if (Parent != parent) { Parent.RemoveFromChildren(this); Parent = parent; Parent.AddToChildren(this); isChangeDetected = true; } if (isChangeDetected) { onUpdated(clone); if (Key >= 0) { DC.Data.NotMatchingChildrenListName_Childs.ItemHasChanged(clone, this); } else if (DC.Data.IsTransaction) { DC.Data.AddTransaction(new TransactionItem(37, TransactionActivityEnum.Update, Key, this, oldItem: clone)); } HasChanged?.Invoke(clone, this); } #if DEBUG DC.Trace?.Invoke($"Updated NotMatchingChildrenListName_Child: {ToTraceString()}"); #endif }
public NotMatchingChildrenListName_Child(string text, NotMatchingChildrenListName_Parent parent, bool isStoring = true) { Key = StorageExtensions.NoKey; Text = text; Parent = parent; #if DEBUG DC.Trace?.Invoke($"new NotMatchingChildrenListName_Child: {ToTraceString()}"); #endif Parent.AddToChildren(this); onConstruct(); if (DC.Data?.IsTransaction ?? false) { DC.Data.AddTransaction(new TransactionItem(37, TransactionActivityEnum.New, Key, this)); } if (isStoring) { Store(); } }
private NotMatchingChildrenListName_Child(int key, CsvReader csvReader) { Key = key; Text = csvReader.ReadString(); var notMatchingChildrenListName_ParentKey = csvReader.ReadInt(); if (DC.Data.NotMatchingChildrenListName_Parents.TryGetValue(notMatchingChildrenListName_ParentKey, out var parent)) { Parent = parent; } else { throw new Exception($"Read NotMatchingChildrenListName_Child from CSV file: Cannot find Parent with key {notMatchingChildrenListName_ParentKey}." + Environment.NewLine + csvReader.PresentContent); } if (Parent != NotMatchingChildrenListName_Parent.NoNotMatchingChildrenListName_Parent) { Parent.AddToChildren(this); } onCsvConstruct(); }
/// <summary> /// Called before any property of NotMatchingChildrenListName_Child is updated and before the HasChanged event gets raised /// </summary> partial void onUpdating(string text, NotMatchingChildrenListName_Parent parent, ref bool isCancelled) { }