MVC :: What is a model?

前端 未结 5 1870
情深已故
情深已故 2021-02-05 04:07

I am at a point where I must make a decision about models. I am aware that models are what you use to do all your database manipulation. But are models restricted to this?

<
5条回答
  •  失恋的感觉
    2021-02-05 04:25

    Don't relate Model with just to database. Think of it as in-memory representation of your currently use data(for the data which is not currently in use, might be in DB and when you access that data, first it will come to Model and then propagate to other parts of the application.). When you done with your data manipulation(which you do in Model) you either save it to Database for some later use. Also, Model is the first class which gets the data filled from DB when you retrieve the data from DB.

提交回复
热议问题