title: How to integrate existing OwinMiddleware into a .Net Core 2.0 app pipeline?
body: <p>I have a handful of existing Owin middleware classes, originally written for .Net 4.6 apps, that follow this pattern:</p>
  
  <pre><code>public class MyMiddleware : OwinMiddleware
  {
      public MyMiddleware(OwinMiddleware next) : base(next)
      { }
  
      public override async Task Invoke(IOwinContext context)
      {
          // do stuff
          await Next.Invoke(context)
      }
  }
  </code></pre>
  
  <p>I'm writing a new .Net Core 2.0 app that I'd like to use those middlewares in (as well as some "new style" middlewares that aren't based on Owin). I'm having trouble finding good documentation or examples of doing this, at least ones that are similar to what I have (for example, <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/owin?view=aspnetcore-2.0" rel="nofollow noreferrer">this</a>)</p>
  
  <p>The one promising thing I have found is that the <code>Microsoft.AspNetCore.Owin</code> package includes an extension method, <code>UseOwin()</code> that seems to be the path forward, but I'm unable to decipher how to use it to invoke my "legacy" middlewares above. I realize that I should use <code>UseOwin()</code> when configuring my <code>IApplicationBuilder</code> but I'm not smart enough to get the details from what I'm reading online.</p>
  
  <p>What's the most straightforward way to do this?</p>