blob: 027b385c984cb020e38d30062dda83b46252dc1c (
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
66
67
68
69
70
71
72
|
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>
/// Gets or sets a value indicating whether this <see cref="IObservableEntity"/> is deleted.
/// </summary>
[EntityFieldName("DELETED")]
bool Deleted { 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 (Do no use this).
/// </summary>
[Obsolete("The method delete is not for use as it prevents the synchronization of remote and local database.")]
void Delete();
/// <summary>
/// Performs a "soft delete" of this entity (Set <see cref="Deleted"/> to true and save).
/// </summary>
void SoftDelete();
/// <summary>
/// Performs a "soft delete" of this entity asynchronously (Set <see cref="Deleted"/> to true and save).
/// </summary>
Task SoftDeleteAsync();
/// <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();
}
}
|