You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Common/Common/Documents/Document.cs

33 lines
1.3 KiB

2 years ago
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; }
}