Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using System.ComponentModel.DataAnnotations;
11 : using System.Runtime.Serialization;
12 : using Cqrs.DataStores;
13 : using Cqrs.Entities;
14 :
15 : namespace Cqrs.Azure.DocumentDb.Entities
16 : {
17 : /// <summary>
18 : /// A projection/entity especially designed to work with Azure DocumentDB (CosmosDB).
19 : /// </summary>
20 : [Serializable]
21 : [DataContract]
22 : public abstract class AzureDocumentDbEntity : Entity
23 1 : {
24 : /// <summary>
25 : /// The identifier of the <see cref="IEntity"/>.
26 : /// </summary>
27 : [Required]
28 : [DataMember]
29 : public override Guid Rsn { get; set; }
30 :
31 : /// <summary>
32 : /// The internal identifier of the <see cref="IEntity"/> used within Azure DocumentDB (CosmosDB).
33 : /// </summary>
34 : [Required]
35 : [DataMember]
36 : public virtual string id
37 : {
38 : get { return string.Format("{0}/{1:N}", GetType().FullName, Rsn); }
39 : set
40 : {
41 : Rsn = new Guid(value.Split('/')[1]);
42 : }
43 : }
44 :
45 : /// <summary>
46 : /// The name of the <see cref="Type"/> of this <see cref="IEntity"/>.
47 : /// </summary>
48 : [Required]
49 : [DataMember]
50 : public virtual string type
51 : {
52 : get { return GetType().FullName; }
53 : set{ }
54 : }
55 :
56 : /// <summary>
57 : /// The order of this <see cref="IEntity"/> to sort by, by default.
58 : /// </summary>
59 : [DataMember]
60 : public override int SortingOrder { get; set; }
61 :
62 : /// <summary>
63 : /// Indicates if this <see cref="IEntity"/> has been deleted, but not removed from the <see cref="IDataStore{TData}"/>,
64 : /// this way entities can be retrieved so an un-deleted operation can be triggered.
65 : /// </summary>
66 : [Required]
67 : [DataMember]
68 : public override bool IsLogicallyDeleted { get; set; }
69 : }
70 : }
|