ChangeConfigurationRequest.cs 1016 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using EVCB_OCPP.Packet.Features;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel.DataAnnotations;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace EVCB_OCPP.Packet.Messages.Core
  10. {
  11. public class ChangeConfigurationRequest : IRequest
  12. {
  13. public ChangeConfigurationRequest()
  14. {
  15. Action = Actions.ChangeConfiguration.ToString();
  16. }
  17. [JsonIgnore]
  18. public string Action { set; get; }
  19. [Required]
  20. [MaxLength(50)]
  21. public string key { set; get; }
  22. [DisplayFormat(ConvertEmptyStringToNull = false)]
  23. [Required(AllowEmptyStrings = true)]
  24. [MaxLength(500)]
  25. public string value { set; get; }
  26. public bool TransactionRelated()
  27. {
  28. return false;
  29. }
  30. public bool Validate()
  31. {
  32. return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
  33. }
  34. }
  35. }