title: A way to set the value of one property after model is bound asp.net core
body: <p>I am creating an asp.net core 2.2 api. I have several model classes, most of which contains a string property CreatorId:</p>
  
  <pre><code>public class ModelOne
  {
      public string CreatorId { get; set; }
      //other boring properties
  }
  </code></pre>
  
  <p>My controllers' actions accept these models with [FromBody] attribute</p>
  
  <pre><code>[HttpPost]
  public IActionResult Create([FromBody] ModelOne model) { }
  </code></pre>
  
  <p>I don't want my web client to set the CreatorId property. This CreatorId field appears in tens of classes and I don't want to set it in the controlers actions manually like this:</p>
  
  <pre><code>model.CreatorId = User.Claims.First(claim =&gt; claim.Type == "id").Value;
  </code></pre>
  
  <p>I can't pollute the model classes with any custom model-binding related attributes. I don't want to pollute the controllers or actions with any model binding attributes. </p>
  
  <p>Now, the question is: is there a way to add some custom logic after model is bound to check (maybe with the use of reflection) if model class contains CreatorId field and then to update this value. If it is not possible from ControllerBase User property, than maybe by looking at the jwt token. The process should be transparent for the developer, no attributes - maybe some custom model binder registered at the application level or some middleware working transparently.</p>