Use BLL functions without reference the DAL in my API

别等时光非礼了梦想. 提交于 2019-11-29 18:37:58
Amit Joshi

In my view, what you are trying to achieve is good way to architect the project. I am also doing same; just small difference that I will explain below. Not referencing DAL in API makes sure that every call to DAL is only through BLL. This is necessary because I want to put my all data processing logic at one place. If it is distributed, it is hard to locate issues.

I have four projects:

  1. Utils (your "blabla" stuff goes here) [References nothing]
  2. DAL (your database stuff goes here) [References Utils]
  3. BLL (your logic stuff goes here) [References DAL and Utils if needed]
  4. Api (your API stuff goes here) [References BLL and Utils if needed]

This is one way reference chain. DAL => BLL => API. References in reverse order should not exist. Utils should be common stuff where common things like Entity declarations, Exceptions, Enums should go.

Note: Eventhough you are not referencing the DAL in API, you have to deploy it.

To avoid using Utils in API, you may need to add one more layer of DTOs and map them with Entities. Refer my other question on same.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!