What is the recommended solution structure for several large websites in asp.net

I'm currently trying to reorganize a project (asp.net mvc) that has no separation at all. just folders: s

  • The project has a bunch of EF Code First classes (People.cs, Exam.cs, Message.cs, etc.)
  • There are several repositories in the project (they all use the EF Data Context)
  • And of course, many controllers and viewing models

We have a Tests project, but we are very good at TDD, so its not what we are currently working on.

I would like to get a clearer separation of the different responsibilities that a project should fulfill, and I would like to receive some recommendations regarding the good project structure that achieves this.

Please, help. thanks in advance

+6
source share
2 answers

I propose to follow the project developed under the control of the domain (DDD), and one of the proposed ways of its calculation would be the creation of the following projects:

Company.Project.Web <- Your MVC application, although you can still use WebForms Company.Project.Domain <- Data Transfer Objects (DTO), ViewModels, business logic, Company.Project.Data events <- Repository Interfaces

Company.Project.Data.EF <- EntityFramework Concrete repository implementation Company.Project.Model <- Your EF CodeFirst Classes

Company.Common <- Regular project of utilities and / or extensions

I would advise you to take a look at Project Silk http://silk.codeplex.com/ from the team of models and practices. Excellent reference implementation of DDD, Repository and MVC, as well as mixing in HTML 5 and jQuery (vNext).

+12
source

We use a similar construct described by jdmonty, but a bit simpler. We do the following:

  • ApplicationName.Web - MVC application
  • ApplicationName.Services - business logic
  • ApplicationName.Domain - EF CodeFirst classes and repositories that act on them
  • ApplicationName.Common . Classes and Utilities Used by Multiple Projects
  • ApplicationName.Tests - Test for various projects

The web project is dependent on the Services project. The Services project depends on the Domain project.

+11
source

Source: https://habr.com/ru/post/893821/


All Articles