In recent times I've been trying to better understand OWIN in aspects of why use it, how it works, and how to use it. As for why I use it I've already asked here and I've already convinced myself that the biggest motivation is to get the more modular and independent components of ASP.NET (MVC, WebAPI, etc.) from the System.Web.dll assembly to increase performance.
What I still do not understand is how it works and how to use it. I understand that it basically has a IDictionary<string, object>
called Environment Dictionary and a delegate Func<IDictionary<string, object>, Task>
that basically points to a function that receives the Environment Dictionary and returns a Task
.
Hence I have heard that this decouples the server application and allows the construction of complex execution pipelines. I really did not understand how this works.
Also, to really use OWIN, I know that if you use a Startup
class with a configuration function it gets an object that implements IAppBuilder
. What would be the role of this interface in all this? Also, it seems that everything is connected with the use of the Use
function of this interface. Again, what does this function really do and how do we actually use it?
I know it allows you to integrate WebAPI, Identity, etc. But I still can not understand how this works and how to use it.