If I want to use ORM in MVC system

Which is/are correct?

  1. Use ORM object to replace Model

  2. Encapsulate ORM inside the Model

  3. Use ORM outside the Model, use ORM to access DB, and then use one instance to store one record of data.

  4. Other better practise

Please give me some example

  • Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask – gnat Jun 4 '14 at 11:52

The Model of the MVC pattern does not refer to a single class, but rather to the (rather large) portion of the application that doesn't interact directly with the user.

This means that if you use an ORM in an application that uses the MVC pattern, then the ORM is part of the Model in MVC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.