ASP Web Api - IoC - Resolve HttpRequestMessage

前端 未结 2 1336
耶瑟儿~
耶瑟儿~ 2020-12-31 12:34

I am trying to set up Castle Windsor with ASP.NET WebAPI.

I am also using the Hyprlinkr package (https://github.com/ploeh/Hyprlinkr) and so need an instance of HttpR

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-31 13:12

    Why not to use already built-in mechanism in ASP.NET Web API - Dependency resolver

    http://www.asp.net/web-api/overview/extensibility/using-the-web-api-dependency-resolver

    In project WebApiContrib there is CastleWindsor resolver implementation, but as I've seen with Dependency resolver

    https://github.com/WebApiContrib/WebApiContrib.IoC.CastleWindsor

    And as Mark said in comment - one of the ways to implement IHttpControllerActivator

    http://blog.ploeh.dk/2012/10/03/DependencyInjectionInASPNETWebAPIWithCastleWindsor.aspx

提交回复
热议问题