public class TenantInitializerEventManager : IEventHandler<EntityCreatedEventData<Tenant>> { private readonly ITenantInitializerService tenantInitializerService;
public TenantInitializerEventManager(ITenantInitializerService tenantInitializerService)
{
this.tenantInitializerService = tenantInitializerService;
}
public void HandleEvent(EntityCreatedEventData<Tenant> eventData)
{
this.tenantInitializerService.CreateNewTenantSeedData(eventData.Entity);
}
}
I have created the below Event Manager, which is calling a method that contains the seed data that I wish to autopopulate the tenant upon creation.
public TenantInitializerEventManager(ITenantInitializerService tenantInitializerService)
{
this.tenantInitializerService = tenantInitializerService;
}
public void HandleEvent(EntityCreatedEventData<Tenant> eventData)
{
this.tenantInitializerService.CreateNewTenantSeedData(eventData.Entity);
}
This Event is not fired when a tenant is created, where do I declare to execute the Event?
Thank you for the answer.
Can we create the Event in the TenantAppService uder the followign method:
public async Task CreateTenant(CreateTenantInput input) {}
Or is there any better place to do it?
Hi again,
Since Tenant is already CRUDed by abp is there any event already implemented for this purpose when a tenant is created?
Thank you ismcagdas
Maybe I wasn't clear enough on my question.
I have created some settings i.e. Countries and I want each tenant to have full control over the Countries of their application.
I also want as soon as the Tenant is created, that I autopopulate a list of countries to start with, before the end user can perform CRUD operations on the Countries settings page.
How can I set a "signal" that as soon as tenant is created, it should autopopulate ot the the Countries Table linked with the Tenant's ID?