title: Use default interface method as controller action ASP.NET Core
body: <p>How to use default interface methods as MVC controller actions? Since interface methods exists on interface type, they aren't discovered by ASP as actions by default. Example:</p>
  <pre><code>public interface IGetEntityControllerMixin&lt;TEntity&gt; : IControllerBase
      where TEntity : class, IEntity, new()
  {
      IRepository&lt;TEntity&gt; Repository { get; }
  
      [HttpGet(&quot;{id:int}&quot;)]
      public async Task&lt;ActionResult&lt;TEntity&gt;&gt; Get(int id)
      {
          var entity = await Repository.GetByIdAsync(id);
  
          return entity == null ? NotFound() : Ok(entity);
      }
  }
  public interface IPagingEntityControllerMixin&lt;TEntity&gt; : IControllerBase
      where TEntity : class, IEntity, new()
  { ... }
  
  [ApiController]
  [Route(&quot;[controller]&quot;)]
  public class MyEntityController : ControllerBase,
                                    IGetEntityControllerMixin&lt;MyEntity&gt;,
                                    IPagingEntityControllerMixin&lt;MyEntity&gt;
  {
      public IRepository&lt;MyEntity&gt; Repository { get; }
      public MyEntityController(IRepository&lt;MyEntity&gt; repository)
          =&gt; Repository = repository;
  }
  </code></pre>