'Trouble using AspNetUsers table within Clean Architecture in Asp.net core web api 6.0

We are migrating our ASP.NET Core 3.1 project to ASP.NET Core 6.0 Web API (clean architecture). https://github.com/jasontaylordev/CleanArchitecture

In our old project, we use IdentityUser (which is not in clean architecture) like this:

old project - User.cs

public class User : IdentityUser
{
    // removed
}  
// This is the table named as AspNetUser in the database 

Now, in our clean architecture project,

public class ApplicationUser : IdentityUser
{}

is inside the Infrastructure layer.

The database connection is in the domain layer (which is not dependent on any other layers).

In the domain layer, I have a User.cs class. This is same as User.cs in our old project. But I could not extends IdentityUser into my new User class. Because in clean architecture, we maintain Identity related files in Infrastructure Layer.

New project - User.cs

public  class User 
{
   // removed
}

My issue is I want to use a foreign key from the AspnetUser table to another class.

Example: FK_SiteUsers_AspNetUsers_UserId.

But ApplicationUser (which extends IdentityUser) is in the Infrastructure layer. Could not use this class into domain Layer in clean architecture

How can I do this? Please anyone help me. Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source