title: Custom tag helper: How do I use complex objects in attributes?
body: <p>I am currently working on an ASP.NET Core custom tag helper. I need to read a complex object from an attribute as follows:</p>
  
  <p><strong>[Models]</strong></p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Page {
    [HtmlAttributeName(page-size)]
    public int size {get; set;}
  }
  
  public class MyControl {
    public Page page {get; set;}
  }
  </code></pre>
  
  <p><strong>[TagHelper class]</strong></p>
  
  <pre class="lang-cs prettyprint-override"><code>[TargetElement("MyControl", Attributes="page-size")]
  public class MyControlTagHelper : TagHelper {
    public Page page {get; set;}
    //Here i have process methods.
  }
  </code></pre>
  
  <p>And now I want to get the page size value in the view as follows:</p>
  
  <pre><code>&lt;MyControl page-size="4"&gt;&lt;/MyControl&gt;
  </code></pre>
  
  <p>I don't know to do this. So far, I tried to provide the full complex object to an attribute <a href="http://www.mikesdotnetting.com/Article/275/custom-taghelpers-in-asp-net-mvc-6" rel="nofollow noreferrer">as shown in this article</a>.</p>
  
  <p>How can I read the complex object's values as <code>page-size</code>?</p>