Models for multiple projects

ICodeInTx 56 Reputation points
2021-01-19T16:47:20.197+00:00

I'm working on a large multi-project solution and I'm curious what other developers opinions are. The project consists of Website (blazor) API (mvc), libraries, console apps, and mobile apps (future). The API uses its own models for Domain Model pattern and these models are not available to other projects. Other applications in the solution needs representation of the model for their own use. Initially I created a Model library to hold common models for data transfer objects and nothing more. As I start to build out the website I find myself in a situation where I need a model that is more specific to the website because it holds data annotations for display purposes and I really don't want to include that information in the common model (library).

I'm considering removing the Model project that has common models and look at the solution on a app by app basis so each application would have its own models for its own purpose.

Pro - There will be no cross-concern in the models and each application will have privilege to modify its own model.

Con - I end up modifying several models for a simple change such as a new property.

What are your design thoughts? How would you architect this solution??

Scott

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,573 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.