I use Autofac to replace ASP.NET deafult DI containor.
I create a db filters with Z.EntityFramework.Plus;
.
I need to apply thoese filters,when DbContext was Activated.
enter image description here
At first I use .net6 everthing was queit right.
The program will first go to the IAsyncAuthorizationFilter
, gets the user’s identifier (OrgCode), and then execute the code in OnActivated only where the DbContext is used.
But I uppergrade to .net8,The program executes all OnActivated before it even gets to the IAsyncAuthorizationFilter
.
NEED HELP,THX~ 😀
I’m trying to remove the DbContext injected through the constructor in the filter.But it still first go OnActivated.
I’d like to possibly register and run OnActivated when I actually use the DbContext, or use some sort of decorator to do that!
Jiaxiang Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.