Should I create in BLL project class the same like poco class in DAL project and return it to UI project if I want to display data from database?

后端 未结 2 1888
情书的邮戳
情书的邮戳 2021-01-26 06:07

I have an architecture question. I have DAL project with poco classes (equivalent tables in database), BLL project and UI project. UI project has reference to BLL project and BL

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-26 06:23

    You should define you POCO (domain) objects in your BLL project, since they are business objects.

    Your DAL should have a reference to the BLL, not the other way around.

    Personally I am a follower of the Onion architecture which places your domain in the centre of your application. Any layer you add should only reference inward, not outward. So by that definition, your BLL is the centre, and is not referencing anything. Add a DAL layer, and it can only reference inwards, so it can reference the BLL. The UI layer is also only referencing the BLL, but not the DAL, since the DAL is an implementation detail.

提交回复
热议问题