|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using Connected.Annotations;
|
|
|
|
|
using Connected.Entities.Annotations;
|
|
|
|
|
using Connected.Entities.Consistency;
|
|
|
|
|
|
|
|
|
|
namespace Common.Documents;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default implementation of the <see cref="IDocument{TPrimaryKey}"/> interface.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="TPrimaryKey">The type of the primary key used by document.
|
|
|
|
|
/// This is usually <c>int</c> or <c>long</c>.
|
|
|
|
|
/// </typeparam>
|
|
|
|
|
[Table(Schema = CommonSchemas.DocumentSchema)]
|
|
|
|
|
public abstract record Document<TPrimaryKey> : ConsistentEntity<TPrimaryKey>, IDocument<TPrimaryKey>
|
|
|
|
|
where TPrimaryKey : notnull
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc cref="IDocument{TPrimaryKey}.Created"/>
|
|
|
|
|
[Ordinal(-1007), Date(Kind = DateKind.SmallDateTime)]
|
|
|
|
|
public DateTimeOffset Created { get; init; }
|
|
|
|
|
/// <inheritdoc cref="IDocument{TPrimaryKey}.Modified"/>
|
|
|
|
|
[Ordinal(-1006), Nullable, Date(Kind = DateKind.SmallDateTime)]
|
|
|
|
|
public DateTimeOffset? Modified { get; init; }
|
|
|
|
|
/// <inheritdoc cref="IDocument{TPrimaryKey}.Code"/>
|
|
|
|
|
[Ordinal(-1005), MaxLength(32), Nullable]
|
|
|
|
|
public string? Code { get; init; } = default!;
|
|
|
|
|
/// <inheritdoc cref="IDocument{TPrimaryKey}.Author"/>
|
|
|
|
|
[Ordinal(-1004), Nullable]
|
|
|
|
|
public int? Author { get; init; }
|
|
|
|
|
/// <inheritdoc cref="IDocument{TPrimaryKey}.Owner"/>
|
|
|
|
|
[Ordinal(-1003), Nullable]
|
|
|
|
|
public int? Owner { get; init; }
|
|
|
|
|
}
|