12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Linq;
- namespace InABox.Core
- {
-
- public interface IEnclosedEntity : ISubObject
- {
- }
-
- public abstract class EnclosedEntity : BaseObject, IEnclosedEntity
- {
- private BaseObject? _linkedParent;
- private string? _linkedPath;
- public void SetLinkedParent(BaseObject parent)
- {
- _linkedParent = parent;
- }
- public void SetLinkedPath(string path)
- {
- _linkedPath = path;
- }
- protected override IOriginalValues CreateOriginalValues()
- {
- return new SubObjectOriginalValues(this);
- }
- protected override ILoadedColumns CreateLoadedColumns()
- {
- return new SubObjectLoadedColumns(this);
- }
- public BaseObject? GetLinkedParent() => _linkedParent;
- public string? GetLinkedPath() => _linkedPath;
-
- protected override void DoPropertyChanged(string name, object? before, object? after)
- {
- LinkedProperties.GetParent(this)?.CascadePropertyChanged(LinkedProperties.GetPath(this) + "." + name, before, after);
- if (LinkedProperties.Find(this, name, out var link, out var parent))
- {
- link.Update(this, parent);
- }
- }
- }
- }
|