1

I am new to ASP.NET MVC and as of right now I have the basic understanding of how MVC works. I have created a simple mvc website which uses only one project utilizing the pattern Model-View-Controller.
But I want to learn how to make an mvc web application that uses a specific architecture and having a hard time looking for references online to help me understand it.
I was given a project, to study, and rewrite it but I don't want to be copying each classes one by one without understanding how it's done, I plan to rewrite it from scratch and just use the existing project a guide.

What I need exactly is if someone can point me to where to start reading to understand this project's architecture:

ProjectSolution
 Project.Web
  //An MVC web application

 Project.DataAccess
  //An edmx file (database first)
  Contracts
    IRepository.cs
    IUnitOfWork
  Repositories
    GenericRepository.cs
  UnitOfWork

 Project.Business
  Contracts
    IService1.cs
    IService2.cs
    ....so on
  Services
   Service1.cs
   Service2.cs
   ....so on

From just relying on my personal code reading capability, I can see that from this setup, it consists of 3 different projects, Project.Web is an MVC webapp, while the other 2 are Class Libraries.
Well, technically, I know how this architecture works, but I want to know how to make it from scratch, I mean, which ones are auto generated, which ones are written individually etc etc. And I also want to learn how ViewModel works, because inside Project.Web there is a folder ViewModels that represents a collection of models that is used in the view.

Gahh! I'm lost, I dont know where to start reading. I don't need explanation on each but can you point me where to find a tutorial or something similar to this project for me to know how to build it. Please help! Thank you!



Note: I know this is not a proper question to be posted here but I am desperate and seeking help from the experienced ones to point me somewhere.

1 Answer 1

2

From the structure you posted it looks like the solution (One solution) has three different projects:

  • 1- Project.web: That the website project itself where you will have all of your views, css, scripts ... in an "ideal implementation of MVC" (depending who are you talking to) the website project should have no logic at all and it's only responsabilty should be the render of the info to the user. so it's basically the V part of the MVC.
  • 2- Project.DataAccess: that's the M ; the project should manage all the data portion of the project and that includes: DAL, ORM, Repositories, UoW...
  • 3- Project.Business The C part, where all the business logic is taking place , where basically all of your classes doing the hard work , i think of it as the CPU.

You mentioned that the 2 projects are class library projects and the Web is a WebSite project and this is an architecture i follow to organize my projects/solution.

Please note that this is an architecture design to organize your projects and in no way is the only or best one. but with any design you might follow try to respect the SoC (Separation of Concerns) goal of the MVC pattern.

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, that is exactly what this project/solution does and I was told to rewrite it to understand it, well, I understand how it works but don't know how to make it. Can you suggest some reading materials for me to follow on how to build a web app following this practice from scratch.
nothing on top of my head. from my own experience you should always keep in mind the SoC aspect and the organization of the project will follow that. Asp.net videos by Scott Allen are a great reference
@super-user The answer above is pretty good. I will suggest adding another Class Library Called Common, In this project you can create all your Enums, Data Transfer Objects, ViewModels, Helpers etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.