EntityDto.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. namespace Abp.Application.Services.Dto
  3. {
  4. /// <summary>
  5. /// A shortcut of <see cref="EntityDto{TPrimaryKey}"/> for most used primary key type (<see cref="int"/>).
  6. /// </summary>
  7. [Serializable]
  8. public class EntityDto : EntityDto<int>, IEntityDto
  9. {
  10. /// <summary>
  11. /// Creates a new <see cref="EntityDto"/> object.
  12. /// </summary>
  13. public EntityDto()
  14. {
  15. }
  16. /// <summary>
  17. /// Creates a new <see cref="EntityDto"/> object.
  18. /// </summary>
  19. /// <param name="id">Id of the entity</param>
  20. public EntityDto(int id)
  21. : base(id)
  22. {
  23. }
  24. }
  25. /// <summary>
  26. /// Implements common properties for entity based DTOs.
  27. /// </summary>
  28. /// <typeparam name="TPrimaryKey">Type of the primary key</typeparam>
  29. [Serializable]
  30. public class EntityDto<TPrimaryKey> : IEntityDto<TPrimaryKey>
  31. {
  32. /// <summary>
  33. /// Id of the entity.
  34. /// </summary>
  35. public TPrimaryKey Id { get; set; }
  36. /// <summary>
  37. /// Creates a new <see cref="EntityDto{TPrimaryKey}"/> object.
  38. /// </summary>
  39. public EntityDto()
  40. {
  41. }
  42. /// <summary>
  43. /// Creates a new <see cref="EntityDto{TPrimaryKey}"/> object.
  44. /// </summary>
  45. /// <param name="id">Id of the entity</param>
  46. public EntityDto(TPrimaryKey id)
  47. {
  48. Id = id;
  49. }
  50. }
  51. }