Does entity framework replace model in MVVM?

Topics: Questions
Sep 16, 2014 at 12:14 PM
Edited Sep 16, 2014 at 2:20 PM
Still struggling with the entity framework usage and feeling a little silly having to ask this.

So to check if I'm thinking correct:
  • Does Entity Framework replace the Model in MVVM
    or
  • Is Entity Framework a layer ontop of the model.
I'm asking this because when reading throug the documentation I see that entities and models both are derived from ModelBase.
And they have so many similarities that I'm struggling to keep them seperated.

Please confirm which option is correct.

Kind regards

Jeroen
Sep 16, 2014 at 11:14 PM
Yes, it is possible to use an EF entity (or code-first model) as model in MVVM with Catel. Depending on the requirements of the VM, you can either inject the model or retrieve it via the UnitOfWork and repositories (or any other method that you prefer).

EF is the DAL, a way of retrieving the models. The models are the actual data representations (thus Customer, Company, Invoice, etc). You can get models via EF (if a database), or they can come from disk, etc. A model is simply a class object holding data without much logic.