You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are migrating our ASP.NET Core 3.1 project to ASP.NET Core 6.0 Web API (clean architecture).
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
{}
My issue is I want to use a foreign key from the AspnetUser table to another class.
public class SiteUsers
{
public int SiteCodeId { get; set; }
public SiteCode SiteCode { get; set; }
public string UserId { get; set; }
public ApplicationUser User { get; set; } // can not use ApplicationUser here. Then How can I use AspnetUser table inside Domain Layer.
}
Example: FK_SiteUsers_AspNetUsers_UserId.
ApplicationUser (which extends IdentityUser) is in the Infrastructure layer. Could not use this class into domain Layer in clean architecture
How can I use a foreign key from the AspnetUser table in Domain Layer? Please anyone help me. Thanks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We are migrating our ASP.NET Core 3.1 project to ASP.NET Core 6.0 Web API (clean architecture).
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
{}
My issue is I want to use a foreign key from the AspnetUser table to another class.
public class SiteUsers
{
public int SiteCodeId { get; set; }
public SiteCode SiteCode { get; set; }
public string UserId { get; set; }
public ApplicationUser User { get; set; } // can not use ApplicationUser here. Then How can I use AspnetUser table inside Domain Layer.
}
Example: FK_SiteUsers_AspNetUsers_UserId.
ApplicationUser (which extends IdentityUser) is in the Infrastructure layer. Could not use this class into domain Layer in clean architecture
How can I use a foreign key from the AspnetUser table in Domain Layer? Please anyone help me. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions