using System.Xml.Serialization; namespace Domain.XML_Model { [Serializable] [XmlRoot(ElementName = "pouvoirs")] public class Pouvoir : BaseEntity { [XmlIgnore] private string? _opposeAsAString; [XmlIgnore] private string? _prolongeableAsAString; [XmlAttribute(AttributeName = "id")] public string Id { get; set; } [XmlAttribute(AttributeName = "nom")] public string? Nom { get; set; } [XmlAttribute(AttributeName = "discipline")] public string? Discipline { get; set; } [XmlAttribute(AttributeName = "seuil")] public int Seuil { get; set; } [XmlAttribute(AttributeName = "action")] public string? Action { get; set; } [XmlIgnore] public bool Opposé { get; set; } [XmlAttribute(AttributeName = "opposé")] public string? OpposeAsAString { get => _opposeAsAString; set { //this.BadBoolField = Convert.ToBoolean(value); if (!value.Equals("True") && !value.Equals("true")) { if (value.Equals("False") || value.Equals("false")) Opposé = false; } else Opposé = true; } } [XmlAttribute(AttributeName = "portée")] public string? Portée { get; set; } [XmlIgnore] public bool Prolongeable { get; set; } [XmlAttribute(AttributeName = "prolongeable")] public string? ProlongeableAsAString { get => _prolongeableAsAString; set { //this.BadBoolField = Convert.ToBoolean(value); if (!value.Equals("True") && !value.Equals("true")) { if (value.Equals("False") || value.Equals("false")) Prolongeable = false; } else Prolongeable = true; } } [XmlAttribute(AttributeName = "description")] public string? Description { get; set; } [XmlIgnore] public int PouvoirId { get; set; } } }