OWIN Launch Anatomy

What are all the hooks in the OWIN startup class? There is little information about this.

For example, one hook is required for each Startup class, since it must have a Configuration method. This information may be collected from Microsoft documentation .

 class Startup { public void Configuration(IAppBuilder appBuilder) { ... } } 

What is the rationale for the lack of an IOwinStartup interface or an IOwinStartup base class in the framework?

 interface IOwinStartup { void Configuration(IAppBuilder appBuilder); } 

How to clean up for my OWIN based application? Does OWIN discover the Dispose method in the Startup class, much like it does the Configuration method?

After a lot of searching, I found this related question: In the OWIN Web API self-service, how do I run the code on shutdown? It is unclear how people answered that the question came to the necessary information. Am I missing critical documentation or are these details of the OWIN startup class elusive as it seems?

+6
source share
1 answer

This is not so much a “hook" as a convention. There is a good article here:

http://www.asp.net/aspnet/overview/owin-and-katana/owin-startup-class-detection

As for why there is no interface, most likely this is because it was not necessary to block it to this level. This is largely reflection based, and you can specify the class and method to use at startup using various configuration options.

In the case of the WebAPI in the example you are referring to, you can do this in the WebApp.Start method and specify StartOptions with the name of the method used, but the convention is Configuration.

Cleaning can be done by getting a cancel token. This information is contained in the documentation that is associated with the examples that you are showing. I'm not sure I understand how you came to the conclusion that the documentation is missing when this is clearly not the case.

http://msdn.microsoft.com/en-us/library/microsoft.owin.builderproperties.appproperties.onappdisposing(v=vs.113).aspx

Of course, it lacks elaboration and examples ... but in this article there are a lot of blog entries ...

You can also read the OWIN specification:

http://owin.org/spec/spec/owin-1.0.0.html

+3
source

Source: https://habr.com/ru/post/979151/


All Articles