In setting up my Windows Service application to self host using Owin based on this article:
http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-se
The WebApp
class uses reflection to get a pointer to the Configuration(IAppBuilder)
method then calls it. If the class you provide as the generic type argument does not have a Configuration
method with the expected arguments then you get an error at run time.
I agree that this is not as discoverable as we would like and I am not sure why the original developers implemented it this way rather than adding a where T: IStartup
constraint instead. Not only would this make it more discoverable without documentation, but would also have allowed the compiler to check this at compile time.
The only advantage to this approach is that the OWIN developers can add more methods or methods with different signatures in the future without breaking existing code.