I am looking for the "best practices" way. For example: If I have an AppService for tenants where a single function exists to create tenants, but in order to create a tenant I need to also create a different entity and save it to the database for an ID, how would I accomplish this without repeating code all over the place?
public class TenantAppService : ApplicationService, ITenantAppService
{
private readonly IRepository<Tenant, long> _tenantRepository;
public TenantAppService(IRepository<Tenant, long> tenantRepository)
{
_tenantRepository = tenantRepository;
}
public void CreateTenant(CreateTenantInput input)
{
Logger.Info("Creating a tenant for input: " + input);
//Create a new Address entity with given input's properties
}
}