Files
2024-09-25 09:45:53 +02:00

74 lines
2.1 KiB
C#

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; }
/// <summary>
/// Codice/Nome applicativo
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
/// </summary>
public string VersText { get; set; } = "0.1a2";
/// <summary>
/// Tag associati a versione, comma separated
/// </summary>
public string RelTags { get; set; } = "";
/// <summary>
/// Versione (calcolata) a partire dal valore Num
/// </summary>
[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;
}
/// <summary>
/// Data di release
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
[ForeignKey("CodApp")]
public virtual ApplicativoModel ApplicativoNav { get; set; }
}
}