Skip to content

How to handle background process #61

Answered by JonPSmith
SomaxSoftware asked this question in Q&A
Discussion options

You must be logged in to vote

As you know background processes don't have a valid user for obvious reasons. I would suggest you create the DbContext manually in your background process. You would need to obtain the DbContextOptions<YourTenantDbContext> service via DI and then use the code below to create the YourTenantDbContext.

using var context = new YourTenantDbContext(optionsViaDi, "The correct DataKey for the tenant you want to access")

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SomaxSoftware
Comment options

Answer selected by SomaxSoftware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants