Using the ASP.net MVC project as a โ€œbaseโ€ project for other MVC projects

Im currently working on a โ€œsetโ€ of internal intranet applications

These are all asp.net MVC applications that will (for various reasons) be deployed as separate applications

Im currently facing a huge amount of duplication -

Each application has essentially the same โ€œouterโ€ shell. This outer shell does not just consider views, it includes authentication logic, etc.

The "internal" view is the actual application.

So, in an ideal world, Id has something like:

MyCompany.Web
Holds _Layout, base controllers, auth, etc.

Then other mvc projects in my solution, such as:

  • MyCompany.Web.App1
    inherits from MyCompany.Web

  • MyCompany.Web.App2
    inherits from MyCompany.Web

etc...

Is there anything I could do to make this easier?

Everything I've tried so far includes xcopying views, etc. into subprojects at assemblies and feels very fragile.

+5
source share
1 answer

Create nuget packages for generic assembly-based code.

Consider whether nuget packages make sense for sharing view or layout files.

Consider creating a project template that includes the use of appropriate nuget packages. This will allow you to follow the same pattern as MVC itself, which allows you to create a new project and update nuget packages as needed. This eliminates the need for frequent changes to the template itself, unless the changes are not easily accessible by nuget.

+1
source

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


All Articles