أنشطة "sergey.sorokin.kz@gmail.com"

  • 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?

Hi, Liming,

There is no exception. The only worng this is that the generated migration doesn't contain the foreing key creation code.

عرض 1 الي 2 من 2 إدخالات
Made with ❤️ on ABP v8.2.0-preview Updated on مارس 25, 2024, 15:11