same issue: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3275#issuecomment-380864224
This is a modular document for abp. You can take look it . https://aspnetboilerplate.com/Pages/Documents/Module-System
please refer: https://support.aspnetzero.com/QA/Questions/6097
use MultiTenancy.Tenant.DefaultTenantName is work for me.
public class Tenant : AbpTenant<User>
{
//Can add application specific tenant properties here
public new const string DefaultTenantName = "NewDefaultTenantName";
//.....
}
private void CreateDefaultTenant()
{
//Default tenant
var defaultTenant = _context.Tenants.IgnoreQueryFilters().FirstOrDefault(t => t.TenancyName == MultiTenancy.Tenant.DefaultTenantName);
if (defaultTenant == null)
{
defaultTenant = new MultiTenancy.Tenant(MultiTenancy.Tenant.DefaultTenantName, MultiTenancy.Tenant.DefaultTenantName);
var defaultEdition = _context.Editions.IgnoreQueryFilters().FirstOrDefault(e => e.Name == EditionManager.DefaultEditionName);
if (defaultEdition != null)
{
defaultTenant.EditionId = defaultEdition.Id;
}
_context.Tenants.Add(defaultTenant);
_context.SaveChanges();
}
}
May be related to https://github.com/aspnetzero/aspnet-zero-core/issues/1843
According to #2767 What problem have you encountered?
Dto does not have to be consistent with the entity.
You can look at the Dto class code in Zero.Low-level (child) Dto does not reference the superior (parent) Dto
https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application.Shared/Authorization/Users/Dto/GetUserForEditOutput.cs https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application.Shared/Authorization/Users/Dto/UserEditDto.cs https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application.Shared/Authorization/Users/Dto/UserRoleDto.cs
I recommend that you do not use self-referencing in Dto.
You have self-referencing DTOs.
refer:https://stackoverflow.com/questions/37251043/automapper-throwing-stackoverflowexception-when-calling-projecttot-on-iquery?answertab=votes#tab-top
https://github.com/aspnetzero/aspnet-zero-core/blob/c25d832d74e031ea622b9477f2e8d671a353c597/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/MultiTenancy/TenantManager.cs#L164
https://github.com/aspnetzero/aspnet-zero-core/blob/c25d832d74/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/MultiTenancy/Demo/TenantDemoDataBuilder.cs#L67
I think you can use Repository here to initialize the relevant data.