Thx for the response. Please consider my comment as feedback. Volo.Saas.Host Tenant app service has create method which includes user data seeding operation.
public virtual async Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input)
{
var tenant = await TenantManager.CreateAsync(input.Name, input.EditionId);
input.MapExtraPropertiesTo(tenant);
await TenantRepository.InsertAsync(tenant);
await CurrentUnitOfWork.SaveChangesAsync();
using (CurrentTenant.Change(tenant.Id, tenant.Name))
{
//TODO: Handle database creation?
await DataSeeder.SeedAsync(
new DataSeedContext(tenant.Id)
.WithProperty("AdminEmail", input.AdminEmailAddress)
.WithProperty("AdminPassword", input.AdminPassword)
);
}
return ObjectMapper.Map<Tenant, SaasTenantDto>(tenant);
}
And it automatically assumes that all tenants use a shared database which is not the %100 cases. In my case i would like assign seperate database for each tenant and method seeds users to the host AbpUsers table.
Beside that DTO has no property about connection string apart from admin email and password which is also not cool
I think it would be better if you leave the workflow of the database seed operation to the developers.But ofc it may depend logical reason which is not able to understand yet. It just feedback
Another question is I am sure that I have removed the TENANTAPPSERVICE and TENANTCONTROLLER from registered service.
Why swagger still listing volo.saas.host.tenant endpoints ? I also don't use ConventionalControllers.Create method in my HttpApiHostModule. Any hint ?
Is there any posibility that we can add attribute which prevents serialization of property ? How can i remove attribute from property ?
public static class NMMApplicationContractsExtensionConfigurator
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
ConfigureProperties();
});
}
private static void ConfigureProperties()
{
ObjectExtensionManager.Instance.AddOrUpdateProperty<SaasTenantCreateDto, string>("AdminEmailAddress",
options =>
{
options.Attributes.Add(new System.Text.Json.Serialization.JsonIgnoreAttribute());
options.Attributes.Remove(new StringLengthAttribute(256));
options.Attributes.Add(new StringLengthAttribute(3)
{
MinimumLength = 1
}
);
});
}
}
Definition done at PreConfigure step
public override void PreConfigureServices(ServiceConfigurationContext context)
{
NMMApplicationContractsExtensionConfigurator.Configure();
}
However, still able to pass validation, that means i couldn't change DTO properties
Thx, Missed one of the underscore,
HeaderTenantResolveContributor: Tries to find current tenant id from HTTP headers. The header name is __tenant by default.