inversion of control - Asp.net Mvc: Ninject - IPrincipal -


i wondering how bind iprincipal httpcontext.current.user in asp.net mvc ninject.

friendly greetings,

pickels

edit:

not sure if matters use own customprincipal class.

you can without need provider in ninjectmodule:

bind<iprincipal>()   .tomethod(ctx => httpcontext.current.user)   .inrequestscope(); 

note, included .inrequestscope() ensure value of method cached once per http request. i'd recommend doing if use provider mechanism.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -