Erix
Erix

Reputation: 7105

How to properly share page components across MVC solutions

I'm looking for the proper way to organize code and projects in this simple scenario in ASPNET MVC.

I have two different solutions, which are MVC Web Applications. I want them to have a common icon or other ui component which is a user avatar / login / logout form. This should be the same across both solutions.

Sharing the authentication / authorization code should be simple enough. I will just move that into a project and reference it in both solutions. But as far as the view piece - I'm not sure. Can I create a partial view in that third project and render that in both the solutions? Is that the best practice or something else?

Upvotes: 0

Views: 36

Answers (1)

Jean Gatto
Jean Gatto

Reputation: 21

A good way to organize a project is to create a solution and in this solution have other child projects.

Example:

  1. School

    1.1 School.Web

    1.2 School.Domain

    1.3 School.CrossCutting

Within the project "School.CrossCutting " You will put classes that can be added as a reference in any project.

Another tip is to study Domain driven Design (DDD).

Upvotes: 1

Related Questions