0

I've used Identity package in WebUI layer. I want to associate these users with the product that I keep in the entity layer.

Checkout below diagram image

Diagram

I cannot reference the Identity user class. How can I do that?

I am getting this below error.

Error

Thanks

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30
  • Not sure why you'd need to reference the whole project. When saving an entity, just pass the associated user ID as a string. – ADyson Aug 13 '20 at 12:12
  • checkout this below link to understand dependencies https://stackoverflow.com/questions/2052579/circular-dependencies – Ram Anugandula Aug 13 '20 at 12:13
  • I wanted to add products for other users from admin users, but I can do as you said, I guess. I will try, thanks. – Enes KAYGUSUZ Aug 13 '20 at 12:28

2 Answers2

1

It seems that you are using the Traditional "N-Layer" architecture. Using this architecture, users make requests through the UI layer, which interacts only with the BLL (Business Logic Layer). The BLL, in turn, can call the DAL (Data Access Layer) for data access requests. The UI layer shouldn't make any requests to the DAL directly, nor should it interact with persistence directly through other means. Likewise, the BLL should only interact with persistence by going through the DAL. In this way, each layer has its own well-known responsibility.

Normally, the DAL and BLL application are class library, when we use it, we could add the project reference (find the build .dll file).

I want to associate these users with the product that I keep in the entity layer. I cannot reference the Identity user class. How can I do that?

So, about this issue, you could try to put the Identity User class in the DAL layer and configure relationship with other model, then add reference in the BLL layer or the UI layer.

More detail information about Common web application architectures, check the following articles:

Common web application architectures

N-Tier Architecture in ASP.NET Core

N-Tier Architecture and Tips

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30
0

You could add a Data Access Layer for your Identity DbContext: Tutorial video

The Business layer can reference the Identity Data Access Layer. The BLL can take care of finding users and finding Products(I'm guess are stored in Adt.DataAccess layer). If you need to do processing of AspNetUsers table against Products table, you can always combine the results of querying both Data Access Layers in memory in the BLL.

enter image description here