c# - Can i create OwinMiddleware per request instead creating a global object -


i'm working on webapi project & migrating owin/katana hosting. have few doubts regarding.

quest ) can create owinmiddleware per request instead creating global object?

i'm able create owinmiddleware not able create them per request. wanted create them per request can insert new object in owinmiddleware dependency. i'm using unity in webapi wanted solution aligned unity.

i found few links :-

http://alexmg.com/owin-support-for-the-web-api-2-and-mvc-5-integrations-in-autofac/

http://www.tugberkugurlu.com/archive/owin-dependencies--an-ioc-container-adapter-into-owin-pipeline

but not able adjust new ioc old unity. can suggest solution

i found way achive :-

        app.use((iowincontext context, func<task> next) =>         {             ilogger logger = {resolve dependency using unity};             customowinmiddleware middleware = new customowinmiddleware(context,next, logger);             return middleware.invoke();         }); 

by way i'm able generate middle ware per request. right way ?


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -