using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LiMan.DB.DBModels { [Table("Releases")] public partial class ReleaseModel { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int IdxRel { get; set; } /// /// Codice/Nome applicativo /// public string CodApp { get; set; } = ""; /// /// Versione applicativo formato semver numerico 4 blocchi /// public string VersNum { get; set; } = "0.0.0.0"; /// /// Versione applicativo, formato testuale libero, può essere uguale a VersNum /// public string VersText { get; set; } = "0.1a2"; /// /// Tag associati a versione, comma separated /// public string RelTags { get; set; } = ""; /// /// Versione (calcolata) a partire dal valore Num /// [NotMapped] public Version VersVal { get { Version answ = new Version(); try { // solo se è una versione valida: SemVer = 2/3 punti int numPunti = VersNum.Length - VersNum.Replace(".", "").Length; if (numPunti >= 2 && numPunti <= 3) { answ = !string.IsNullOrEmpty(VersNum) ? new Version(VersNum) : new Version(); } } catch { } return answ; } } [NotMapped] public bool IsReleased { get => ReleaseDate <= DateTime.Now; } /// /// Data di release /// public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100); [ForeignKey("CodApp")] public virtual ApplicativoModel ApplicativoNav { get; set; } } }