dotvvm icon indicating copy to clipboard operation
dotvvm copied to clipboard

Support FromRoute & FromQuery on constructor parameters

Open exyi opened this issue 4 years ago • 0 comments

It would be intuitive (at least for me) if these attributes also worked on parameters in constructor, not only on properties. The main advantage from properties is that I can validate and process the parameters right away:

class VM {
   public VM([FromQuery] string fromDate = null) {
      this.FromDate = fromDate != null ? DateTime.Parse(fromDate, "format string") : null;
   }
}

For ease of implementation, I'd only support these attributes at the start of argument list, since the rest of them will be handled by Dependency Injection.

exyi avatar Oct 22 '21 19:10 exyi