It would be good practice to separate the data model from the display model.
To do this, create a project with only the bank part, any model/Pattern known (DAC, Repository, etc) and put the models there.
In the project MVC
put the models you will use in the views, even if they are the same as the models in the EntityFramework
. Why?
Imagine you have a model for data entry in a form, and want to add to this model validations, DataAnnotations
for example. You can do this freely in this model without having to change the EntityFramework
.
If for example you have a field in the database for documents, CPF, CNPJ, RG, etc that are numeric types. In the view you want to use a mask for points, tracts, bars, etc, and want to use a string attribute, how would you do? Separating the models would be no problem.
Here only some situations where it is recommended separates the data model from the display model, so I suggest leaving in the MVC Models folder the models that serve exclusively to the Views, and the database models in another project.
An example would be:
ProjetoDados
Models
... aqui vão as models do EntityFramework
ProjetoMVC
Controllers
Views
Models
... aqui vão as models para atender as Views
Ideal would be for you to create your DDD application. That’s all.
– Marco Souza
Em qual pasta seria ideal (boas praticas), criar o Entity Framework?
What do you mean, create what? This sentence makes no sense.Na pasta MODEL, ou eu posso criar uma pasta chamada Context fora da pasta MODEL?
Yes, the question is whether you should, and it depends on what you want to do, what you don’t have in the question.Pois dentro do Entity Framework criado contém as classes do banco seria dentro do model, não é ?
Probably. The question is not very clear. So the current answers end up not making much sense either.– Maniero