diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-12 17:03:38 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-12 17:03:38 +0200 |
| commit | e75cf513acb73558e948d6012b45f221c718dcf7 (patch) | |
| tree | 386d3cd79048edbfb91860b6a063fba3c660fec5 /Software/Visual_Studio/Tango.BL/ObservableEntity.cs | |
| parent | c923d6611ffa64605879779c490a979e03daa189 (diff) | |
| download | Tango-e75cf513acb73558e948d6012b45f221c718dcf7.tar.gz Tango-e75cf513acb73558e948d6012b45f221c718dcf7.zip | |
Added cascade delete for Machine -> Jobs.
Added addresses auto complete to users & roles.
Maybe Users & Roles module is complete..
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/ObservableEntity.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/ObservableEntity.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs index 43d5c06de..e46e54ad3 100644 --- a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs @@ -166,7 +166,7 @@ namespace Tango.BL /// <returns></returns> public Task SaveAsync(ObservablesContext context) { - return Task.Factory.StartNew(() => + return Task.Factory.StartNew(() => { Save(context); }); @@ -296,11 +296,26 @@ Maybe you have deleted an entity that was no yet inserted into database?", LogCa return me == other; } + /// <summary> + /// Deletes this entity using an SQL statement which will cause the database delete cascade effect. + /// </summary> + /// <param name="context"></param> + /// <returns></returns> public Task DeleteCascadeAsync(ObservablesContext context) { return context.Database.ExecuteSqlCommandAsync(String.Format("DELETE FROM {0} WHERE GUID='{1}'", this.GetType().GetCustomAttribute<TableAttribute>().Name, Guid)); } + /// <summary> + /// Performs entity field validation. + /// Will throw an exception with the proper message if one of the fields is invalid. + /// </summary> + /// <param name="context">The context.</param> + public virtual void Validate(ObservablesContext context) + { + + } + #region Operator Overloading //public static bool operator ==(ObservableEntity<T> observable1, ObservableEntity<T> observable2) |
