Skip to content

identity in Clean Architecture #399

Answered by jasontaylordev
asgharb asked this question in Q&A
Discussion options

You must be logged in to vote

The template isolates ApplicationUser within Infrastructure, since it depends on IdentityUser. IdentityUser comes from ASP.NET Core Identity, and ideally, it's best to avoid dependencies on other frameworks within Core (the Application and Domain layers form Core).

If you are not concerned about a dependency on ASP.NET Core Identity, move ApplicationUser into the Domain. It will then be relatively simple to extend Identity and access ApplicationUser within Core.

If you want to remain independent of ASP.NET Core Identity, the missing piece is a Domain entity representing your users, let's keep it simple and create a User entity in the Domain:

public class  User
{
  public int Id { get; set; }

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by asgharb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants
Converted from issue

This discussion was converted from issue #349 on July 29, 2021 03:09.