Levi Beckman
Levi Beckman

Reputation: 533

Multiple ASP.NET MVC Applications; Server for shared UI Assets?

Given: I am part of a team converting/rebuilding nearly 150 small ASP Classic, ASP.NET, & ASP.NET MVC intranet applications into a new single custom intranet application architecture solution. We are targeting ASP.NET MVC 5. The individual legacy apps will be converted to individual build-able product projects within the new solution/architecture.

Goal: My goal is to provide a vision for the User Interface asset management and references. This vision should incorporate shared assets, as well as unique product assets.

Questions: For ease of deployment, I am considering a fairly flat shared UI project. Then, for unique project asset needs, I was considering keeping them in their respective projects, rather than housing them in the UI project, somehow nested/organized by product. Are there any opinions or concerns that I should consider with this approach?

Thanks, Levi

Upvotes: 1

Views: 387

Answers (1)

Seth MacPherson
Seth MacPherson

Reputation: 141

While this question begs for further clarification I will outline the strategy that worked for me while working for a large healthcare provider and had a similar daunting task.

CSS & Images

  1. Use an assets domain to host css and images ( http://assets.mycompany.org )
  2. If an assets domain is unavailable leverage IIS virtual directories to implement something like: http://mycompany.org/assets or http://mycompany.org/shared/assets at the global level.
  3. Adopt product/project named stylesheets to easily identify over-rides within your architecture

    \my-org-root
    \my-org-root\assets\my-org-global.css
      # This is the global stylesheet that gets included for every HTML request
    \my-org-root\project-apples
    \my-org-root\project-apples\assets\css\apples.css
    \my-org-root\project-pears
    \my-org-root\project-pears\assets\css\pears.css
    \my-org-root\product-animals
    \my-org-root\product-animals\assets\css\animals.css
    \my-org-root\product-animals\lions\assets\css\lions.css
    \my-org-root\product-animals\tigers\assets\css\tigers.css
    
  4. This won't come as a surprise: use Sass. It will help maintain consistency and keep you from having an embolism.

  5. Leverage partials as often as possible

    Html.RenderPartial("~/Views/Shared/_Product.cshtml", product);
    
  6. Aggressively hunt down and destroy inline styles.

  7. Be prepared to do a lot of cleanup.

Files & Video

If you have to support file uploads or self-hosted videos there are a handful of ways to proceed but they will largely be determined by your security policy. Ideally, I'd recommend a hosted, secured solution like Amazon's S3. These keeps BLOBS outside of your problem domain and keeps you focused on UI-based files. If you cannot use a hosted solution then you'll need the assets directory strategy all the more.

\my-org-root\project-apples
\my-org-root\project-apples\assets\video\FILE-ID-REF.ext
\my-org-root\project-apples\assets\files\2014\1\22\FILE-ID-REF.ext
# or, perhaps more simply
\my-org-root\project-apples\assets\files\FILE-ID-REF.ext

Need clarification? Just ask.

Upvotes: 1

Related Questions