For serialization scenarios, added default constructor to named element and p...
6e15bf30
Pedro Silva
committed
succeeded
4 changed files
D20Tek.Common.xml
/D20Tek.Common/D20Tek.Common.xml
/D20Tek.Common/D20Tek.Common.xml
NamedElement.cs
/D20Tek.Common.Shared/DataTypes/NamedElement.cs-5+21
/D20Tek.Common.Shared/DataTypes/NamedElement.cs
Add comment 34 protected NamedElement(T id, string name, string description)
Add comment 35 {
Add comment 36 this.Id = id;
Add comment 37 Minus   this.Name = !string.IsNullOrEmpty(name) ? name : throw new ArgumentNullException("name");
Add comment 37 Plus   this.Name = name;
Add comment 38 this.Description = description;
Add comment 39 }
Add comment 40
Add comment 41 /// <summary>
Add comment 42 Minus   /// Gets the element id.
Add comment 42 Plus   /// Initializes a new instance of the <see cref="NamedElement{T}"/> class.
Add comment 43 Plus   /// Default constructor for serialization.
Add comment 43 44 /// </summary>
Add comment 45 Plus   protected NamedElement()
Add comment 46 Plus   {
Add comment 47 Plus   }
Add comment 48 Plus  
Add comment 49 Plus   /// <summary>
Add comment 50 Plus   /// Gets or sets the element id.
Add comment 51 Plus   /// </summary>
Add comment 44 52 [Required]
Add comment 45 53 [JsonPropertyName("id")]
Add comment 46 54 public T Id
Add comment 47 55 {
Add comment 48 56 get => this.id;
Add comment 49 Minus   private set => this.SetProperty<T>(ref this.id, value);
Add comment 57 Plus   set => this.SetProperty<T>(ref this.id, value);
Add comment 50 58 }
Add comment 51 59
Add comment 52 60 /// <summary>
Add comment 56 64 public string Name
Add comment 57 65 {
Add comment 58 66 get => this.name;
Add comment 59 Minus   protected set => this.SetProperty<string>(ref this.name, value);
Add comment 67 Plus   set
Add comment 68 Plus   {
Add comment 69 Plus   if (string.IsNullOrEmpty(value))
Add comment 70 Plus   {
Add comment 71 Plus   throw new ArgumentNullException("Name");
Add comment 72 Plus   }
Add comment 73 Plus  
Add comment 74 Plus   this.SetProperty<string>(ref this.name, value);
Add comment 75 Plus   }
Add comment 60 76 }
Add comment 61 77
Add comment 62 78 /// <summary>
Add comment 65 81 public string Description
Add comment 66 82 {
Add comment 67 83 get => this.description;
Add comment 68 Minus   protected set => this.SetProperty<string>(ref this.description, value);
Add comment 84 Plus   set => this.SetProperty<string>(ref this.description, value);
Add comment 69 85 }
Add comment 70 86
Add comment 71 87 /// <inheritdoc/>
D20Tek.Common.Standard.xml
/D20Tek.Common.Standard/D20Tek.Common.Standard.xml
/D20Tek.Common.Standard/D20Tek.Common.Standard.xml
NamedElementTests.cs
/D20Tek.Common.UnitTests/DataTypes/NamedElementTests.cs
/D20Tek.Common.UnitTests/DataTypes/NamedElementTests.cs