diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-16 20:46:30 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-16 20:46:30 +0300 |
| commit | 5282624fc0f2ba7b5191219a0e941c9b53d1843b (patch) | |
| tree | f4dc6603a125727a59ef956cc05a8dd4b8e2779d /Software/Visual_Studio/Tango.BL | |
| parent | e9f317178f6454836d488cf1e65d04b20b02d334 (diff) | |
| download | Tango-5282624fc0f2ba7b5191219a0e941c9b53d1843b.tar.gz Tango-5282624fc0f2ba7b5191219a0e941c9b53d1843b.zip | |
Telemetry Logs & Machine Updates.
Diffstat (limited to 'Software/Visual_Studio/Tango.BL')
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs | 9 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs index 867665f89..f3b0237d8 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs @@ -12,6 +12,8 @@ namespace Tango.BL.Entities { public class TangoUpdate : TangoUpdateBase { + public static event EventHandler<TangoUpdate> TangoUpdateSaved; + [NotMapped] [JsonIgnore] public TangoUpdateStatuses UpdateStatus @@ -166,5 +168,12 @@ namespace Tango.BL.Entities base.OnStatusChanged(status); RaisePropertyChanged(nameof(UpdateStatus)); } + + public override void OnBeforeSave() + { + base.OnBeforeSave(); + + TangoUpdateSaved?.Invoke(this, this); + } } } diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs index 3d330b797..6bacf610b 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs @@ -133,9 +133,13 @@ namespace Tango.BL { foreach (var entity in ChangeTracker.Entries().Where(x => x.State == EntityState.Added || x.State == EntityState.Modified).ToList()) { - if (entity is IObservableEntity && entity != null) + if (entity is IObservableEntity en) { - (entity as IObservableEntity).OnBeforeSave(); + en?.OnBeforeSave(); + } + else if (entity.Entity is IObservableEntity en2) + { + en2?.OnBeforeSave(); } } |
