小编kan*_*ead的帖子

How do I configure AutoFac to inject IPrincipal into custom DbContext on each ApiRequest

We are developing a website that uses the repository pattern/unit of work approach. We use Autofac to assist with the construction of objects between these tiers of abstraction.

I've written an AutoFac authentication filter that currently grabs Basic Auth headers and creates an IPrincipal object and assigns it to HttpContext.Current.User

In our custom DbContext class I want Autofac to get a copy of this IPrinipal object without having to look into System.Web.HttpContext (in an effort to keep this decoupled)

有没有人对我如何让 …

asp.net-mvc dependency-injection unit-of-work autofac repository-pattern

5
推荐指数
0
解决办法
886
查看次数