c# - Why OWIN middleware is not implemented as some interface or abstraction class? -


i cannot figure out why first parameter in method iappbuilder use(object middleware, params object[] args); of iappbuilder interface not require implementation of interface, simple object ?!
i expected this

public interface imiddleware {     public void invoke(iowincontext context) } 

and

iappbuilder use(imiddleware middleware, params object[] args); 

eventually middleware has executed @ point, , how can called if object ??!!
if middleware interface following code not possible

public class somestupidmiddleware {     public void somemethod1()     {         console.writeline("method1");     }      public void somemethod2()     {         console.writeline("method2");     } }  class startup {     public void configuration(iappbuilder app)     {         app.use(new somestupidmiddleware());     } } 

but code compiled generates runtime error the type 'owineducation.somestupidmiddleware' not match known middleware pattern

the owinmiddleware class provided microsoft implementing custom middleware implementation of owin server (katana) owin not microsoft tech. using middleware object, katana can use non-katana middleware doesn't inherit owinmiddleware.

this blog post talks middleware signatures , implementation in more detail. important bit of information requirement have signature matching

func<idictionary<string, object>, task 

you can check out owin site, , section on application delegates


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -