title: How to validate only a part of Model State in asp.net core 2 web api
body: <p>We are using a Usermaster DTO in 2 different projects.
  <br></p>
  
  <pre><code>public class UserMaster : BaseProperties
  {      
  
      [BsonElement]
      [BsonRequired]
      [Required]
      public string FirstName { get; set; }
  
      [BsonElement]
      [BsonRequired]
      [Required]
      public string LastName { get; set; }
  
      [BsonElement]
      [BsonRequired]
      [EmailAddress]
      [Required]
      public string EmailId { get; set; }
  
      [BsonElement]
      [BsonRequired]
      [DataType(DataType.Password)]
      [Required]
      public string Password { get; set; }
  
      [BsonIgnore]
      [DataType(DataType.Password)]
      [Required]
      public string NewPassword { get; set; }        
  }
  </code></pre>
  
  <p>Now we are using this DTO in 2 different projects. 
  <br><strong>Project 1</strong> is Admin in asp.net MVC 5.0, There we can use ModelState.IsValidField to validate only a part of this whole Model. <br>  <strong>Project 2</strong> is a Web Api build in asp.net core 2. There i could not find any solution which can only validate Email and Password for login purpose.. <br><br>
  <strong><em>Basically i am facing issue in asp.net core 2 web api where i could not specify the exact data member that could be only validate. I have to pass anything on other [Required] fields to validate request. likewise ModelState.IsValidField</em></strong> <br><br> Any solutions??</p>