Interface Reutilization (embedding) for Large Projects - asp.net-mvc

First of all, sorry for any english mistakes. Its my first post on Stack Overflow and english is not my native language.
Im facing a problem on a web project being currently developed here at my company. We are making a large overhaul at a legacy application.
The application is being built by different teams in a manner that one team is writing a framework/foundation application that will be consumed by all the other applications (think as modules or even standalone satellite applications). All the applications are currently being written in ASP.NET MVC 3. and the framework (and the others) have views, models, controllers and static resources as any mvc applications (like the login screen, the menus, layouts, etc).
Currently we are organizing the projects like desired using a modified version of the MVCContrib Portable Areas.
My.Framework.Web
My.Sales.Web
My.Customer.Web
The MVCContrib project seems kinda of dead right now and we are looking for other approaches to solve this particular situation.
So my question is: We are doing this the right way? i mean, there is another way to treat a situation where strong interface reuse between projects are a necessity? This seems to me like a common situation but could not find anything similar (on scale) on the internet or books.
Best regards.

You can go with something like these:
The MVCContrib way (as you mentioned)
Griffin's MVC Plugin system
Simple MVC Areas solution
I think they are all have a disadvantage that is you need to copy View and Content files if you don't want them to be in your plugin assembly. But if you want to, you can use razorgenerator that can embed views in your assembly. So you can create areas then embed all of stuff in area assembly using razorgenerator and them reference it in your host project and register that area.
BTW, I think your application architecture (that is like Composite Web Application) is good for creating several products that have similar services or modules in them.

Related

How to build Plug and play MVC applications?

Building an MVC web application. Will be a single page app highly driven by javascript (require.js, pager.js, jquery, knockout, etc).
This application would have its own built-in pages, controllers, etc - and would need to be able to accept external plug-and-play functionality as well.
Ideally, I could just drop a .dll from another MVC web app into the main app and it would inherit not only the dropped in app's controllers, but would also bring in its web files (.htm, *.ts, *.js, *.css, etc).
Imagine having a home page with tiles for each installed dll. Referencing a new dll would add the app's tile to the home page - which is an entry point into the app.
Each plug-and-play app would need to adhere to our routing design (for MVC controllers and PagerJS).
Lastly, each app would need to be able to share user login data.
I know my questions are a bit broad, but I just wanted to get some ideas and see where it takes me.
MvcContrib has introduced Portable Area that is a set of reusable multi-page functionality can be dropped into an application to provide rich functionality without having to custom build functionality that is literally the same in every application.
This could be considered a plug-in or add-in type of functionality. The portable portion of this approach is that the area can be distributed as a single assembly rather than an assembly and a host of other files, like views or other html assets that need to be managed and maintained over time.
By making a portable area totally self contained in a single assembly, this should allow for easier reuse and upgrades to the area. The challenge for doing something like this has been how do you allow enough control over the User Interface by the application yet still allow the actual views to be packaged with the logic.
The description above is a part of a popular project in CodePlex which could help you to understand/use the technology behind the concept of Plug-able MVC application.
ASP.Net MVC Portable Areas via MvcContrib is a post by Eric Hexter that describes Portable Area in detail.

Building Dotnetnuke like App using Asp .net MVC

Can some one guide me how to build an app like dotnetnuke using asp .net mvc? The idea goes like this.
Build a core portal management app
The core app will have basic features like settings/users/pages etc.,
Then build modules/plugins on top of this and load them dynamically
I checked the http://www.chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/ article, but I think this is not what I want.
My question is to know how to build the core? The core should have options to load the controllers & views dynamically.
I also tried MEF but this does not seem to have an option to do the above loading of controllers & views dynamically.
Can someone give pointers of how to do this?
Umbraco and Orchard are both open source ASP.NET MVC content management systems. If you can't think of any good ways to approach it - it would be worth spending a couple days combing through the source code of these applications and seeing how they do it.
Typically when working with plugins and loading things dynamically you'll want to have a good understanding of polymorphism, building interface classes, reflection, etc. You may want to pick up head first design patterns - all that is not ASP.NET MVC specific.

Umbraco with bespoke application

For the my project I am currently umbraco platform as CMS to work with other Bispoke (custom) application that is going to be developed in MVC3. The scope of the project roughtly is as follows:
1) Product Download & Deployment (Bispoke)
2) Product Documentation (CMS)
3) Suport (tickts & its workflow cycle) (Bispoke)
4) Blogs (CMS)
My question is what is the best approach to use Umbraco to integrate it with Bispoke apps? There will be some functionalities which will be shared between CMS and Bispoke apps.So I would like to get these two under one roof.
Any idea how to achive this?
Thx
This is quite a broad question so it's hard to answer definitively.
However there are some areas that you need to watch out for.
Firstly take a look at this question which talks about MVC and Umbraco integration:
MVC and Umbraco integration.
Next is the question of shared functionality. This is a broader architectural issue. In this case create a business logic layer which can be used by either Umbraco or MVC. That way you can share the functionality and keep the actual MVC and Umbraco portions of the app nicely separated.
The biggest issue will be sharing of things like templates or UI code that could be shared but implemented differently depending on if it is being consumed by MVC or WebForms.
It's rather hard to be any more specific.

How should I design a shared Module that is needed in 2 different ASP.NET MVC Applications?

I'm designing a Module that is to be consumed by two distinct WebSites. Everything will be written in MVC (the module and both web applications).
I would like to design my module so that the code can be included from a shared location. I only want to maintain a single version. My first thought was the Area feature of MVC 2. But from my reading it appears as though MVC 2 only "officially" supports Inline Areas.
It sounds like MultiProject support for Areas could be dropped in the near future. What are the pros and cons of Areas implemented as single projects vs multiple projects in asp.net mvc
Are there any alternatives?
A real world example of my design would be creating an MVC Shopping Cart (this would be the shared Module) and consuming it on two different MVC web sites (say a Book Store and a Bicycle Parts Store).
MVC Contrib's Portable Areas are just what you need:
http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx
My experience has been nothing but positive. Have 3 apps sharing 3 portable areas. One is going into production pretty soon.
You can still make it an Area, maintain it in one place and copy it to other projects when needed. There's no way I know to make it work out of the box without setting up the appropriate routes in the consuming web project.
Other than that, I would be interested in a solution too.

How to design a plugin architecture for ASP.NET with MVC Web application

Introduction:
Now I know this question could be very broad and it would be too hard to answer without me asking something specific. So All I ask is just some direction, or a brief high level explanation of a design, or maybe there is already some framework out there that could help me get started...I'm not sure.. I have never designed a plugin architecture before, so maybe there is some resource/example you could point me to on the web that would help me learn so that I may come up with my own solution.
Details of my question:
My intention is I would like to create a plug-in architecture for a new pet-project that I am building in ASP.NET MVC.
I would like to design it so that it has some sort of plug-in ability for all, or at least most, of the application's components.
The reason I would like to do this, is so that I may be able to do deployments with nearly zero down time. The idea is that when I want to deploy the latest version I would drop in the new DLLs into a specific folder, and the application would load up the new plug ins and that is it.
For exapmle, lets say I add a new "contacts" feature to my web application where users can search, add and delete contacts. I would like to be able to deploy that by way of plugins.
Is something like this even possible for Web Applications? Or am I just dreaming?
It's definitely possible.
You will need to define a pretty comprehensive interface that represents everything your plugins will have to do. You should approach it by differentiating what is "core" to your application, and where the extensibility points are. For example, where will the plugins be accessed? Will they be tabs on a page, or links in a sidebar? What properties does each plugin need to have in order to fit into the plugin container?
Generally, plugins are enumerated via reflection by looking for assemblies that implement the plugin interface.
Just for encouragement, we've done this with an enterprise product that provides a generic framework for "management" interfaces for web sites. Developers just need to drop in a plugin dll that builds specific property pages, and they show up in the management interface menu, all the navigation is taken care of, and their dll's just have to worry about their own domain logic.
There is always the dll-way where you define some interfaces that plugins follow.
But for web application, especially ASP.NET MVC, you need a controller, views and so. Probably these can be included in a dll file using prepared controller factory to handle that, but it would be hard to develop these plugins.
Some inspiration for code (or db) embedded content: Haacked about that
ASP.NET MVC version 2 will support areas, where you can put some parts of the application into different folders within the app. This way you can just upload some files and the app will recognize these new files. Read more there Haacked blog
PS: I found another person here on S.O. asking the same question as me:
Plug-in architecture for ASP.NET MVC It might be useful for someone researching the same topic.

Resources