EntityDocument.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. namespace InABox.Core
  3. {
  4. public interface IEntityDocument<T> : IEntityDocument where T : IEntityLink
  5. {
  6. new T Entity { get; }
  7. [Obsolete("Replaced by Entity")]
  8. [ObsoleteProperty(nameof(Entity))]
  9. new T EntityLink { get; }
  10. IEntityLink IEntityDocument.Entity => Entity;
  11. [Obsolete]
  12. [ObsoleteProperty(nameof(Entity))]
  13. IEntityLink IEntityDocument.EntityLink => EntityLink;
  14. }
  15. [UserTracking(typeof(User))]
  16. public abstract class EntityDocument<T> : Entity, IPersistent, IRemotable, IEntityDocument<T> where T : BaseObject, IEntityLink, new()
  17. {
  18. [EntityRelationship(DeleteAction.SetNull)]
  19. [EditorSequence(2)]
  20. public DocumentTypeLink Type => InitializeField(ref _type, nameof(Type));
  21. private DocumentTypeLink? _type;
  22. [EntityRelationship(DeleteAction.Cascade)]
  23. [NullEditor]
  24. public T Entity => InitializeField(ref _entity, nameof(Entity));
  25. private T? _entity;
  26. [Obsolete("Replaced with Entity")]
  27. [ObsoleteProperty(nameof(Entity))]
  28. public T EntityLink
  29. {
  30. get => Entity;
  31. set { }
  32. }
  33. [EntityRelationship(DeleteAction.Cascade)]
  34. [EditorSequence(1)]
  35. public DocumentLink Document => InitializeField(ref _document, nameof(Document));
  36. private DocumentLink? _document;
  37. [Obsolete("Replaced with Document")]
  38. [ObsoleteProperty(nameof(Document))]
  39. public DocumentLink DocumentLink
  40. {
  41. get => Document;
  42. set { }
  43. }
  44. [TimestampEditor(Visible = Visible.Optional)]
  45. [EditorSequence(3)]
  46. public DateTime Superceded { get; set; }
  47. [NullEditor]
  48. public byte[]? Thumbnail { get; set; }
  49. [MemoEditor]
  50. public String Notes { get; set; }
  51. //[NullEditor]
  52. //public string Annotations { get; set; }
  53. }
  54. public enum EntityDocumentAnnotationType
  55. {
  56. Line,
  57. Ellipse,
  58. Rectangle,
  59. Text,
  60. Ink,
  61. OKStamp,
  62. WarningStamp,
  63. ErrorStamp,
  64. Popup
  65. }
  66. [UserTracking(typeof(User))]
  67. public class EntityDocumentAnnotation : Entity, IPersistent, IRemotable, ILicense<CoreLicense>
  68. {
  69. public Guid EntityDocument { get; set; }
  70. public int Page { get; set; }
  71. public EntityDocumentAnnotationType Type { get; set; }
  72. public string Data { get; set; } = "";
  73. }
  74. }