Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abp4.4 can't many to many #9834

Closed
ma7x opened this issue Aug 17, 2021 · 3 comments
Closed

abp4.4 can't many to many #9834

ma7x opened this issue Aug 17, 2021 · 3 comments

Comments

@ma7x
Copy link

ma7x commented Aug 17, 2021

in the 4.3.3
public DbSet<AppUser> Users { get; set; }
and in the 4.4
public DbSet<IdentityUser> Users { get; set; }

I want many to many table User and GameRound, AbpUser entity is gone

public class GameRound : FullAuditedAggregateRoot<Guid>
    {
        public string Name { get; set; }
        public RoundStatus Status { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime? EndTime { get; set; }
        public string Remark { get; set; }

        public List<GameRoundUser> GameRoundUsers { get; set; }
    }


public class GameRoundUser
    {
        public Guid UserId { get; set; }
        public IdentityUser User { get; set; }

        public Guid GameRoundId { get; set; }
        public GameRound GameRound { get; set; }
    }

protected override void OnModelCreating(ModelBuilder builder)


builder.Entity<GameRoundUser>()
                .HasOne(pt => pt.User)
                .WithMany("GameRoundUsers")
                .HasForeignKey(pt => pt.UserId);
            builder.Entity<GameRoundUser>()
                .HasOne(pt => pt.GameRound)
                .WithMany(t => t.GameRoundUsers)
                .HasForeignKey(pt => pt.GameRoundId);

then add-migration
The entity type 'GameRoundUser' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.
I search documentation
https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
but id dit not work
#my question is how to many-to-many relationship table IdentityUser and GameRound

@realLiangshiwei
Copy link
Member

I don't understand what you mean.

@ma7x
Copy link
Author

ma7x commented Aug 17, 2021

I don't understand what you mean.

how many-to-many relationship IdentityUser in abp4.4

@ma7x
Copy link
Author

ma7x commented Aug 17, 2021

I fix it thanks #1517

@ma7x ma7x closed this as completed Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants