Logged in user and Task.Run

0
0

Hi,

In version 3.0 I could do this:

public Task RunImportAsync(CancellationToken cancellationToken)
 {
 myCancellationToken = cancellationToken;

task = Task.Run(() =>
 {
 DoImport();
 });
 return task;
 }

In version 3.1 I must do this to preserve the logged in user for the code inside Task.Run:

public Task RunImportAsync(CancellationToken cancellationToken)
 {
 var impersonatedUser = Csla.ApplicationContext.User;
 myCancellationToken = cancellationToken;

task = Task.Run(() =>
 {
 Csla.ApplicationContext.User = impersonatedUser;
 DoImport();
 });
 return task;
 }

What do you think? Is there a setting or something I can do to make it work as before?

Best regards,
Wilfred

  • You must to post comments
0
0

User impersonation is a system feature, not a Wisej issue. If you have a small runnable sample that shows a Wisej related issue we can look at this further.

  • Wilfred Schønegge
    Understand. Must have missed something under the conversion. I will investigate more. Thanks.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.