In a layered architecture using Entity Framework, should I return POCO classes from the BLL? (Architecture guidance needed)

后端 未结 3 2101
-上瘾入骨i
-上瘾入骨i 2021-02-09 02:36

I\'ve been reading too much probably and am suffering from some information overload. So I would appreciate some explicit guidance.

From what I\'ve gathered, I can use V

3条回答
  •  终归单人心
    2021-02-09 03:27

    You don't need to do anything in particular... as Mark said, there is no "right" answer. However, if your application is simple enough that you would simply be duplicating your classes (e.g. BookInfoUI & BookInfoBLL), then I'd recommend just using the business classes. The extra layer wouldn't serve a purpose, and so it shouldn't exist. Eric Evans in DDD even recommends putting all your logic in the UI layer if you app is simple and has very little business logic.

    To make the distinction, the application layer should have classes that model what happens within the application, and the domain layer should have classes that model what happens in the domain. For example, if you have a search page, your UI layer might retrieve a list of BookSearchResult objects from a BookSearchService in the application layer, which would use the domain to pull a list of BookInfo.

提交回复
热议问题