diff --git a/docs/en/Best-Practices/Application-Services.md b/docs/en/Best-Practices/Application-Services.md index c5d1b51393..9c17b6db21 100644 --- a/docs/en/Best-Practices/Application-Services.md +++ b/docs/en/Best-Practices/Application-Services.md @@ -26,6 +26,7 @@ Example: ```c# +[Serializable] public class IssueDto : FullAuditedEntityDto { public string Title { get; set; } @@ -34,6 +35,7 @@ public class IssueDto : FullAuditedEntityDto public Collection Labels { get; set; } } +[Serializable] public class IssueLabelDto { public Guid IssueId { get; set; } @@ -54,6 +56,7 @@ public class IssueLabelDto Example: ````C# +[Serializable] public class IssueWithDetailsDto : FullAuditedEntityDto { public string Title { get; set; } @@ -62,12 +65,14 @@ public class IssueWithDetailsDto : FullAuditedEntityDto public Collection Labels { get; set; } } +[Serializable] public class MilestoneDto : EntityDto { public string Name { get; set; } public bool IsClosed { get; set; } } +[Serializable] public class LabelDto : EntityDto { public string Name { get; set; } @@ -129,6 +134,7 @@ Task CreateAsync(CreateQuestionDto questionDto); The related **DTO**: ````C# +[Serializable] public class CreateQuestionDto { [Required] diff --git a/docs/en/Best-Practices/Data-Transfer-Objects.md b/docs/en/Best-Practices/Data-Transfer-Objects.md index 2d25ce7f41..0c8580abb7 100644 --- a/docs/en/Best-Practices/Data-Transfer-Objects.md +++ b/docs/en/Best-Practices/Data-Transfer-Objects.md @@ -4,4 +4,5 @@ * **Do** inherit from the pre-built **base DTO classes** where possible and necessary (like `EntityDto`, `CreationAuditedEntityDto`, `AuditedEntityDto`, `FullAuditedEntityDto` and so on). * **Do** define DTO members with **public getter and setter**. * **Do** use **data annotations** for **validation** on the properties of DTOs those are inputs of the service. -* **Do** not add any **logic** into DTOs except implementing `IValidatableObject` when necessary. \ No newline at end of file +* **Do** not add any **logic** into DTOs except implementing `IValidatableObject` when necessary. +* **Do** mark all DTOs as **[Serializable]** since they are already serializable and developers may want to binary serialize them. \ No newline at end of file