title: How to transfer DataAnnotations from model to viewModel in asp.net core?
body: <p>In my ASP.NET Core project, How can I transfer DataAnnotation attributes from Subject to SubjectViewModel without duplicating them?</p>
  
  <pre><code>public class Subject
  {
      public int Id { get; set; }
  
      [Required(ErrorMessage = "Name is Required")]
      [MaxLength(200, ErrorMessage = "Name MaxLength is 200")]
      public string Name { get; set; }
  
      public string Description { get; set; }
  }
  
  public class SubjectViewModel
  {
      public int Id { get; set; }
      public string Name { get; set; }
      public string Description { get; set; }
  }
  </code></pre>