Why and When you should create a new project in a visual studio solution? To be more specific, when you should separate the main project in multiple projects?
We all know that Database files should be separated by main project, that Entity Framework models should be separated, but what about "components"?
Let's assume i have a WebAPI project, with some Apis and some features, including Entity Framework and Database files. Atm these features are included in the main project and my solution structure is:
- App.Api [Main project, With Feature1, Feature2, Feature3, FeatureX, Reference projects App.Models]
|- ApiControllers
|- Helpers
|- Managers
|- Assets
|- Web.config
- App.Models [Models Project]
|- Entity Framework Auto Generated Models
- App.Database [Database Project]
|- Sql Files
What if i split my features in multiple projects and include them in the main project, using the main project as "HEAD" of the other projects? Something like:
- App.Api [Main project, reference Projects App.Feature.Feature1, App.Feature.Feature2, App.Feature.Feature3, App.Feature.FeatureX, App.Models]
|- ApiControllers
|- Web.config
- App.Feature.Feature1 [Library Project - Feature 1, splitted from main project]
|- Managers
|- Helpers
|- Other files *.cs
- App.Feature.Feature2 [Library Project - Feature 2, splitted from main project]
|- Managers
|- Helpers
|- Other files *.cs
- App.Feature.Feature3 [Library Project - Feature 3, splitted from main project]
|- Managers
|- Helpers
|- Other files *.cs
- App.Feature.FeatureX [Library Project - Feature X, splitted from main project]
|- Managers
|- Helpers
|- Other files *.cs
- App.Models [Models Project]
|- Entity Framework Auto Generated Models
- App.Database [Database Project]
|- Sql Files
After that i could but some unit testing attached to each project:
- App.Api [Main project]
- App.Feature.Feature1 [Feature 1, splitted from main project]
- App.Feature.Feature1.Tests
- App.Feature.Feature2 [Feature 2, splitted from main project]
- App.Feature.Feature2.Tests
- App.Feature.Feature3 [Feature 3, splitted from main project]
- App.Feature.Feature3.Tests
So, this is the question. Why, why not and when create multiple projects?
I find more clean this approach instead of first