title: Bind to complex object using [FromRoute] in ASP.NET Core 3.x gives null
body: <p>I have a simple controller which allows a route path constrained by a regex pattern in a 'complex object'. When I try to read the single property from the object it is always null.</p>
  <p>The <code>ModelState</code> is showing an errors collection saying:</p>
  <blockquote>
  <p>The ActorId field is required</p>
  </blockquote>
  <p>So it appears to be a model binding issue and not a validation issue.</p>
  <p>I feel like I'm missing a pattern in the <code>[HttpGet]</code> block or something.</p>
  <h3>ActorIdParameter.cs</h3>
  <pre><code>public sealed class ActorIdParameter
  {
      [Required]
      [RegularExpression(@&quot;^.*nm(\d{5}|\d{7})$&quot;)]
      public string ActorId { get; set; }
  }
  </code></pre>
  <h3>ActorsController.cs</h3>
  <pre><code>[HttpGet(&quot;{actorIdParameter}&quot;)]
  public async Task&lt;IActionResult&gt; GetActorByIdAsync([FromRoute]ActorIdParameter actorIdParameter)
  {
      _ = actorIdParameter ?? throw new ArgumentNullException(nameof(actorIdParameter));
          
      // validation result
      if (!ModelState.IsValid) //&lt;---this is always false
          return ValidationProcessor.GetAndLogInvalidActorIdParameter(method, logger);
  }
  </code></pre>
  <p>Code is called using this example: http://localhost:4120/api/actors/nm0000206</p>
  <p>There are several other posts which deal with the <code>[FromQuery]</code> and <code>[FromBody]</code> but I can't find anything that deals with the route path. It seems like the <code>{actorIdParameter}</code> needs something to say &quot;get the ActorId property within that object&quot; or something.</p>
  <p>I feel like I need the complex object for the regex matching. Alternatively I could switch from the <code>ActorIdParameter</code> object to a <code>string</code> and possibly decorate it inline on the <code>GetActorByIdAsync</code> method but I'm curious if anyone has any suggestions?</p>