kan*_*ead 5 asp.net-mvc dependency-injection unit-of-work autofac repository-pattern
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)
有没有人对我如何让 AutoFac 获取此 IPrincipal 并将其注入我的自定义 DbContext 类中的每个 Web API 调用有任何提示?
任何帮助表示赞赏
| 归档时间: |
|
| 查看次数: |
886 次 |
| 最近记录: |