- ABP Framework version: v4.3.0
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace: No
- Steps to reproduce the issue:
I have the following AbpUser class:
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser
{
        ...
        public Guid? SettingId { get; set; }
        public virtual ICollection<UserClient> Clients { get; set; }
        private AppUser()
        {
            Clients = new List<UserClient>();
        }
}
UserClient is defined like this:
public class UserClient : Entity<Guid>
{
    public string Name { get; set; }
    public Guid UserId { get; set; }
}
When I add the relation one to one for Settings and many to one between AbpUser and UserClients, there is no relation in the migration class at all.
builder.Entity<AppUser>(b =>
{
    b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users"); //Sharing the same table "AbpUsers" with the IdentityUser
    b.ConfigureByConvention();
    b.ConfigureAbpUser();
    b.ConfigureExtraProperties();
    ...
    b.HasOne<Setting>().WithOne().HasForeignKey<AppUser>(x => x.SettingId);
    b.HasMany(x => x.Clients).WithOne().HasForeignKey(x => x.UserId);
});
Reading the article didn't resolve the migration issue for me. How do I add 2 relations (one AbpUser should have many UserClients) and (one ApbUser has one Setting) to get correct relations in the migration?
4 Answer(s)
- 
    0hi What's Exception message and stack trace?Can you repro the problem use the template project then share it with me? liming.ma@volosoft.com 
- 
    0Hi, Liming, There is no exception. The only worng this is that the generated migration doesn't contain the foreing key creation code. 
- 
    0hi Can you repro the problem use the template project then share it with me? liming.ma@volosoft.com 
- 
    0This question has been automatically marked as stale because it has not had recent activity. 
 
                                