title: Blazor: Razor component inherited parameter of base class not set
body: <p>I've got a problem with one of my razor component libraries. </p>
  
  <p>I've got an abstract base class <code>RazorHtmlComponent</code> for my components with a parameter property <code>[Parameter] public string InlineClass { get; set; }</code> which shall be used for css classes to be mapped to the actual component. Then I've got another base class per component containing the component specific properties which is definined like this: <code>abstract class BaseRazorButton: RazorHtmlComponent</code></p>
  
  <p>My component, in this example <code>RazorButton.razor</code> inherits from the abstract button base class <code>BaseRazorButton</code>.</p>
  
  <p>The problem is, when I instantiate a razor button, and I set the property <code>InlineClass</code> to any value, it stays null within my actual <code>RazorButton</code> instance.</p>
  
  <p>Here's a minimal code example for better understanding: </p>
  
  <p>Base class:</p>
  
  <pre><code>public abstract class RazorHtmlComponent : ComponentBase, IRazorHtmlComponent
  {
    [Parameter] public string InlineClass { get; set; }
  
    public DomDefinitionMapper ClassMapper { get; }
  
    ...
  
    protected RazorHtmlComponent()
    {
      ClassMapper = new DomDefinitionMapper(InlineClass);
    }
  </code></pre>
  
  <p>Dom definition mapper: </p>
  
  <pre><code>  public class DomDefinitionMapper
    {
      public List&lt;Func&lt;string&gt;&gt; DefinitionRepository { get; } = new List&lt;Func&lt;string&gt;&gt;();
  
      public DomDefinitionMapper(string definition = "")
      {
        if (!string.IsNullOrEmpty(definition))
        {
          DefinitionRepository.Add(() =&gt; definition);
        }
      }
  
      public string GetDefinitions(char separator = default)
        =&gt; separator.Equals(default) ? 
            string.Join(" ", DefinitionRepository.Select(i =&gt; i()).Where(i =&gt; i != null)) 
          : string.Join($" {separator}", DefinitionRepository.Select(i =&gt; i()).Where(i =&gt; i != null));
    }
  </code></pre>
  
  <p>Button base class:</p>
  
  <pre><code>public abstract class BaseRazorButton: RazorHtmlComponent
  {
    ...
  }
  </code></pre>
  
  <p>Razor button component:</p>
  
  <pre><code>@inherits BaseRazorButton
  
  &lt;button class="@ClassMapper.GetDefinitions()"&gt;
    @Text
  &lt;/button&gt;
  </code></pre>
  
  <p>Instantiation of a Razor button:</p>
  
  <pre><code>&lt;RazorButton InlineClass="page" 
               Text="1"/&gt;
  </code></pre>
  
  <p>When I inspect within in the browse, the class "page" defined within using the <code>InlineClass</code> parameter is not set. In debug mode, the  <code>ClassMapper</code> <code>DefinitionRepository</code> does not contain the class. </p>
  
  <p>Am I missing something? I just don't understand why it doesn't work :/ </p>