Base solution for your next web application
Open Closed

Job to create tenants to migrate from old database #11127


User avatar
0
marble68 created

Prerequisites

11.0 MVC Core

We have an older system and I'm trying to move customers to the new one.

I am able to get the data, and create entities, etc. However, I made a job that creates the tenant with an admin user via the tenant app service.

Inside the Unit Of Work Im using ISession and telling it to use null as the tenantID and my Id as the user id.

When the Unit Of Work for that is completed, then I then try to set the session to that new tenant id and the id of the created admin user.

I can see the entity in the database.

When I try and create entities (using the entities' app services) - I get exceptions of not authorized.

If I do it as my, it sets the tenant ID to null on the objects.

I'm really struggling to get this to work - any suggestions would be helpful.

Thanks.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @marble68

    Could you share the code block which works but sets TenantId to null ?

    Thanks