I am using AbpSession.UserId inside EF Core filter. However, I am trying to use impersonation with AbpSession.Use, but with no luck.
My current understanding is that EF Core filters are created at start of session. UserId gets read and stored in the filter at that time. When I use AbpSession.Use(2,2) method, I can see AbpSession.UserId is updated. However, it would seem EF Core filter does not re-retrieve the UserId.
How can I make EF Core filters update with the most recent UserId?
2 Answer(s)
-
0
Hi,
If you get the value of UserId as ABP Framework does for TenantId here https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.EntityFrameworkCore/EntityFrameworkCore/AbpDbContext.cs#L77 using a method, it might work.
-
0
@kworkme
Did you have a chance to try ?