Skip to content

IdentityRole relation exception #18169

Closed
Closed
@mwlt68

Description

@mwlt68

Is there an existing issue for this?

  • I have searched the existing issues

Description

I create a new entity which is related to IdentityRole ( Volo.Abp.Identity).
But when i try to get IdentityRole with "WithDetailsAsync" it throw an exception.

Entity Class

public class ContestCoRoleSetter : FullAuditedEntity<Guid>
{
    public ContestCoRoleSetter(
       Guid id,
       Guid contestId,
       Guid identityRoleId) : base(id)
    {
        ContestId = contestId;
        IdentityRoleId = identityRoleId;
    }

    protected ContestCoRoleSetter()
    {

    }

    [ForeignKey(nameof(Contest))]
    public Guid ContestId { get; protected set; }

    public virtual Contest Contest { get; set; }

    [ForeignKey(nameof(IdentityRole))]
    public Guid IdentityRoleId { get; protected set; }

    public virtual IdentityRole IdentityRole { get; set; }

}

EntityConfiguration

       builder.Entity<ContestCoRoleSetter>(b =>
        {
            b.ToTable(nameof(OjsDbContext.ContestCoRoleSetters), OjsConsts.DbSchema);
            b.ConfigureByConvention();
            b.HasKey(x => x.Id);
            b.HasOne(x => x.Contest).WithMany(x => x.ContestCoRoleSetters).HasForeignKey(x => x.ContestId);
            b.HasOne(x => x.IdentityRole).WithMany().HasForeignKey(x => x.IdentityRoleId);
        });

Query

var a = (await Repository.WithDetailsAsync(i => i.IdentityRole)).Where(x => x.ContestId == input.ContestId).ApplyFilter(input);

Exception

42P01: relation "IdentityRole" does not exist POSITION: 522

Reproduction Steps

No response

Expected behavior

Getting ContestCoRoleSetter with IdentityRole when i call "WithDetailsAsync(i => i.IdentityRole)" method.

Actual behavior

It throw an exception.

42P01: relation "IdentityRole" does not exist POSITION: 522

Regression?

IDK.

Known Workarounds

No response

Version

5.1.4

User Interface

MVC

Database Provider

EF Core (Default)

Tiered or separate authentication server

Tiered

Operation System

Windows (Default)

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions