You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get some user information while doing some operations in the AuditableEntityInterceptor.cs
I notice that if I inject "IIdentityService identityService" in the constructor of AuditableEntityInterceptor, then the following code will freeze in DependencyInjection.cs:
options.AddInterceptors(sp.GetServices());
For what I observe, if I comment out this line in DependencyInjection.cs, then the code runs fine:
services.AddScoped<ISaveChangesInterceptor, AuditableEntityInterceptor>();
So my understanding is that something goes wrong when it tries to build the IdentityService for the IIdentityService interface in the AuditableEntityInterceptor.cs constructor.
Probably is something that I don't understand, maybe some circular dependency?
I had the same issue when I tried to inject IIdentityService in the constructor of CurrentUser.cs. In this case I was not able to generate and run migrations, it hangs at some point.
Any idea why I cannot use IIdentityService in AuditableEntityInterceptor or CurrentUser.cs?
#412 seems to be related but ICurrentUservice is now IUser. Here it mentions "Update: If you need the current user in any other command/query you can simply ask for an ICurrentUserService and for an IIdentityService using dependency injection and can access the user info with this." This is similar of what I want to do, but not in a command/query, but in the AuditableEntityInterceptor or in the IUser itself.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I am trying to get some user information while doing some operations in the AuditableEntityInterceptor.cs
I notice that if I inject "IIdentityService identityService" in the constructor of AuditableEntityInterceptor, then the following code will freeze in DependencyInjection.cs:
options.AddInterceptors(sp.GetServices());
For what I observe, if I comment out this line in DependencyInjection.cs, then the code runs fine:
services.AddScoped<ISaveChangesInterceptor, AuditableEntityInterceptor>();
So my understanding is that something goes wrong when it tries to build the IdentityService for the IIdentityService interface in the AuditableEntityInterceptor.cs constructor.
Probably is something that I don't understand, maybe some circular dependency?
I had the same issue when I tried to inject IIdentityService in the constructor of CurrentUser.cs. In this case I was not able to generate and run migrations, it hangs at some point.
Any idea why I cannot use IIdentityService in AuditableEntityInterceptor or CurrentUser.cs?
#412 seems to be related but ICurrentUservice is now IUser. Here it mentions "Update: If you need the current user in any other command/query you can simply ask for an ICurrentUserService and for an IIdentityService using dependency injection and can access the user info with this." This is similar of what I want to do, but not in a command/query, but in the AuditableEntityInterceptor or in the IUser itself.
Thanks,
Juan
Beta Was this translation helpful? Give feedback.
All reactions