aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/IObservableEntity.cs
diff options
context:
space:
mode:
authorRoy <roy.mail.net@gmail.com>2018-03-01 23:27:24 +0200
committerRoy <roy.mail.net@gmail.com>2018-03-01 23:27:24 +0200
commit65d7f918b273a572d2d9a1d08a2797ea76b10850 (patch)
tree9ec592ba65b765153b4e400d90f11d764dc98d00 /Software/Visual_Studio/Tango.BL/IObservableEntity.cs
parent7281ce18b916f327f263e938624e8c0d25374620 (diff)
downloadTango-65d7f918b273a572d2d9a1d08a2797ea76b10850.tar.gz
Tango-65d7f918b273a572d2d9a1d08a2797ea76b10850.zip
Another BL Optimization /:
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/IObservableEntity.cs')
-rw-r--r--Software/Visual_Studio/Tango.BL/IObservableEntity.cs82
1 files changed, 82 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.BL/IObservableEntity.cs b/Software/Visual_Studio/Tango.BL/IObservableEntity.cs
new file mode 100644
index 000000000..9e0a8801d
--- /dev/null
+++ b/Software/Visual_Studio/Tango.BL/IObservableEntity.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Data.Entity;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.BL
+{
+ /// <summary>
+ /// Represents an observable database entity.
+ /// </summary>
+ public interface IObservableEntity : IParameterized
+ {
+ /// <summary>
+ /// Occurs after this observable has been saved.
+ /// </summary>
+ event EventHandler Saved;
+
+ /// <summary>
+ /// Gets or sets the entity identifier.
+ /// </summary>
+ [Column("ID")]
+ [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
+ [ParameterIgnore]
+ Int32 ID { get; set; }
+
+ /// <summary>
+ /// Gets or sets the entity unique identifier.
+ /// </summary>
+ [Key]
+ [Column("GUID")]
+ [ParameterIgnore]
+ String Guid { get; set; }
+
+ /// <summary>
+ /// Gets or sets the entity last updated data and time.
+ /// </summary>
+ [Column("LAST_UPDATED")]
+ [ParameterIgnore]
+ DateTime LastUpdated { get; set; }
+
+ /// <summary>
+ /// Saves the changes on this entity to database.
+ /// </summary>
+ void Save(ObservablesContext context);
+
+ /// <summary>
+ /// Attaches this observable to the proper DbSet.
+ /// </summary>
+ void Attach(ObservablesContext context);
+
+ /// <summary>
+ /// Detaches this observable from the proper DbSet.
+ /// </summary>
+ void Detach(ObservablesContext context);
+
+ /// <summary>
+ /// Saves the changes on this entity to database asynchronously.
+ /// </summary>
+ /// <returns></returns>
+ Task SaveAsync(ObservablesContext context);
+
+ /// <summary>
+ /// Deletes this entity from the database.
+ /// </summary>
+ void Delete(ObservablesContext context);
+
+ /// <summary>
+ /// Deletes this entity without saving changes to data base.
+ /// </summary>
+ void DefferedDelete(ObservablesContext context);
+
+ /// <summary>
+ /// Deletes this entity from the database.
+ /// </summary>
+ Task DeleteAsync(ObservablesContext context);
+ }
+}