using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; namespace Core.Blueprint.SQLServer.Entities { /// /// Represents the base class for SQL Server entities, providing common properties for auditing and state management. /// public abstract class BaseSQLAdapter : IBaseSQLAdapter { /// /// Gets or sets the identifier for the entity. /// [Key] [JsonPropertyName("id")] public int Id { get; init; } /// /// Gets or sets the unique identifier for the entity. /// [JsonPropertyName("guid")] public string Guid { get; init; } /// /// Gets or sets the timestamp when the entity was created. /// Default value is the current UTC time at the moment of instantiation. /// [JsonPropertyName("createdAt")] public DateTime? CreatedAt { get; init; } /// /// Gets or sets the identifier of the user or system that created the entity. /// [JsonPropertyName("createdBy")] public string? CreatedBy { get; set; } /// /// Gets or sets the timestamp when the entity was last updated. /// Null if the entity has not been updated. /// [JsonPropertyName("updatedAt")] public DateTime? UpdatedAt { get; set; } /// /// Gets or sets the identifier of the user or system that last updated the entity. /// Null if the entity has not been updated. /// [JsonPropertyName("updatedBy")] public string? UpdatedBy { get; set; } /// /// Gets or sets the status of the entity, indicating whether it is active, inactive, or in another state. /// Default value is . /// [JsonPropertyName("status")] [JsonConverter(typeof(JsonStringEnumConverter))] public StatusEnum Status { get; set; } protected BaseSQLAdapter() { Guid = System.Guid.NewGuid().ToString(); CreatedAt = DateTime.UtcNow; } } }