3

I am developing an asp.net mvc solution, which contains the three layers:

  • Data Access Layer

  • Business Layer

  • Entity Layer

Each layer is a project.

I have developed the controllers and views, but no Models. Instead of using Model, I am using the Entity layer as Model.

My question is: Is this still an MVC project?

I attach an image of my solution to better explain my question.

enter image description here

  • Despite the name, the Models directory is meant to be used for ViewModels. Often, a View requires data that is specific to the View itself (think "element is minimized"). These kinds of properties tend to clutter/obfuscate the purpose of objects so they are best segregated into dedicated ViewModels. While you can certainly opt out of using ViewModels, for anything other than a trivial CRUD application you are going to end up polluting your Entities with View state. FWIW, The UI layer is always the most tedious layer to develop. – king-side-slide Aug 15 '18 at 18:39
  • 2
    Yes, it is still an MVC project. Your Data Access Layer, Business Layer and Entity Layer are all part of the Model. – Robert Harvey Aug 15 '18 at 19:26
-1

When you use an entity in a view, in a controller or anywhere, you must use it by namespace. For that reason, It is not important where entities locate.

You can delete Models folder and you can put entities in the other project.

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.