1

We have an abstract asp.net mvc project which has many copies. Actually every copy project has almost same functionality. But sometimes it can be different in some actions and controllers. Also, every copy project has their own theme. But they share most of javascript codes from abstract base project.

In this aspect, we have faced some difficulties.

  • First, we can't inherit mvc views so every copy project has their own views. When we want to change a functionality, we have to implement this in the views of every project.
  • Also javascript is headache in this approach. Because, sometimes you have to use html hierarchy in the javascript. And every html code is different because of different views.
  • Every-time when we start to a new copy project, it is a pain for us. Because even-though we try to stick to the base abstract project, we have to depart from the base project.

So, we need a project structure that can provide us to build new projects like theme changing. I have looked into MEF structure. I don't know what happens if we make copy projects as a plugin. Also I don't want to integrate views into assembly file as a resource. Because it is not easily modifiable. Also I have looked into some MVC theme structures, but this is not a good solution because it is not inheritable.

What is your suggest?

oruchreis
  • 866
  • 2
  • 12
  • 28
  • Sounds like a tricky problem. Would it be possible to migrate to a full blown CMS system like Umbraco or DotNetNuke? The advantage of CMS'es is that they support multiple websites hosted on the same IIS instance (but you don't need to do this), and they have plugin systems for functionality, themes and so on. You could perhaps roll frequently used views into reusable plugins? – Grubl3r Apr 16 '13 at 08:01
  • Our web system is a little bit complicated and complex. I don't think a CMS system can handle that. Also we have to modify it a lot. I've mentioned in my post about plugin architecture. When you put the views in a plugin, you have to compile end deploy every time. It is not easily modifyable. – oruchreis Apr 17 '13 at 09:52

1 Answers1

0

not sure if you already found a solution for your problem but here is my 2 cents

I've also have multiple MVC projects and some times I need to share views across all of them. To solve the JS issue, I've created a "CDN" project which only provides the static files (JS,CSS, Assets) for all the other apps. So my JS call would be

<script type="text/javascript" src="http://my_cdn_app/Scripts/myscript.js"></script>

For the views problem, I've found this razor generator, where you can have a bunch of views compiled in a class library (pretty cool ey) The downside is that you have your markup in a library rather than on the mvc views which can be a pain to update http://razorgenerator.codeplex.com/

So you can have a base CSS and base JS, coming from the CDN and specific themes/overloads for each stand alone mvc app.

I've also had to implement a API app which provides json data to populate shared markup or I can also transmit the whole markup view through jsonP to the other apps

I hope it helps. Cheers

julianox
  • 758
  • 1
  • 7
  • 9