Referencing ApplicationUser in the Infrastructure library from an entity in the ApplicationCore library using Clean Architecture

In Clean Architecture:

Application Core Types

• Entities (business model classes that are persisted) and Aggregates

• Interfaces

• Services

• DTOs

• Specifications

• Exceptions

Infrastructure Types

• EF Core types (DbContext, Migrations)

• Data access implementation types (Repositories)

• Infrastructure-specific services (FileLogger, SmtpNotifier, etc.)

So the ApplicationUser.cs is an entity, it shouls be in Application Core


User is an entity and it should be in Core layer.

But you shouldn't use ApplicationUser : IdentityUser in the Core layer because it's tied up to the ASP.NET Identity. The Core layer should not know what technologies are going to implement the domain.

What if tomorrow you want to use another library for user management? That's not the Core layer's concern.

What you can do is to use an interface or base User class in the Core layer and let the Infrastructure layer be worried about the library choice decision.