aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs
blob: 71da4fa7cc6f9d6eed08cc6aa39043651e4f86d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.DAL.Observables
{
    /// <summary>
    /// Represents an observable database entity.
    /// </summary>
    public interface IObservableEntity
    {
        /// <summary>
        /// Gets or sets the entity identifier.
        /// </summary>
        [EntityFieldName("ID")]
        Int32 ID { get; set; }

        /// <summary>
        /// Gets or sets the entity unique identifier.
        /// </summary>
        [EntityFieldName("GUID")]
        String Guid { get; set; }

        /// <summary>
        /// Gets or sets the entity last updated data and time.
        /// </summary>
        [EntityFieldName("LAST_UPDATED")]
        DateTime LastUpdated { get; set; }

        /// <summary>
        /// Saves the changes on this entity to database.
        /// </summary>
        void Save();

        /// <summary>
        /// Saves the changes on this entity to database asynchronously.
        /// </summary>
        /// <returns></returns>
        Task SaveAsync();

        /// <summary>
        /// Deletes this entity from the database.
        /// </summary>
        void Delete();

        /// <summary>
        /// Removed this entity from it's DB SET without saving changes.
        /// </summary>
        void SoftDelete();

        /// <summary>
        /// Deletes this entity from the database.
        /// </summary>
        Task DeleteAsync();

        /// <summary>
        /// Gets a collection of entities which are dependent on this entity.
        /// </summary>
        /// <returns>Collection of entities names and guids</returns>
        List<KeyValuePair<String, String>> GetDependentEntitiesNameAndGuid();
    }
}