Where does the “business logic layer” fit in to an MVC application?

后端 未结 4 1946
萌比男神i
萌比男神i 2020-12-04 04:58

First, before anyone screams dupe, I had a hard time summarizing it in a simple title. Another title might have been \"What is the difference between a domain model and MVC

4条回答
  •  北海茫月
    2020-12-04 05:46

    In my opinion,

    Model -

    Should not contain business logic, it should be pluggable(WCF like scenario). It is used to bind to view so, it should have properties.

    Business Logic -

    It should be placed at "Domain Services Layer", it is separate layer altogether. Also, will add one more layer here "Application Services".

    App Services talks to Domain Services layer to apply business logic and then lastly return the Model.

    So, Controller will ask Application Service for Model and the flow will go like,

        Controller->Application Services(using domain services)->Model
    

提交回复
热议问题