如何在我的操作方法中按请求DbContext访问OWIN实例?

时间:2016-10-26 05:30:03

标签: c# asp.net asp.net-web-api owin owin-middleware

我从未注意到这段代码:

    ' Configure the db context and user manager to use a single instance per request
    app.CreatePerOwinContext(AddressOf ApptDbContext.Create)

所以我甚至编写了一个DbContext过滤器,用于在请求的开头和结尾创建和处理实例。

现在看起来OWIN为我做了这个,我如何访问它所照顾的DbContext

问题How exactly IAppBuilder.CreatePerOwinContext should be used?的已接受答案对我不起作用,没有无参数Get(),只使用该类型的AssemblyQualifiedName会返回null。

0 个答案:

没有答案