Building Dotnetnuke like App using Asp .net MVC - 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.

Related

Interface Reutilization (embedding) for Large Projects

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.

Plugin architecture in .NET like wordpress

We're going to upgrade our old classic ASP system to .net.
This old system manages different ecommerce sites.
What we would like to do is to create a asp.net (vb) system like wordpress with plugins.
This way, the layout can be completely different between the sites.
For example a login plugin can be anywhere on the page with different settings for layout and display. Or even with a separate plugin css.
This way the setup time is minimal for the webmasters, and the developers can develop new plugins.
Now i'm stuck at .net 2. and haven't had time to follow the advantages of 4 or even 4.5.
I just start reading about MVC.
What is a good solution to follow? MVC? Any available frameworks for this setup?
If you have any links o samples, please share.
thanks for the help.
The Orchard CMS project is a good example of a modular, plug-in based MVC application: http://www.orchardproject.net/ Although not branded as a Microsoft project, they have contributed to its development, and I believe part of the intent is for it to be used as a reference architecture.
There are also any number of very similar questions here on SO, many with good answers:
How to use Plugin Architecture in ASP.NET?
Plugin-like architecture in .NET
I can't personally think of any reason you would stick with .NET 2.0 if 4.0 or 4.5 is an option. Each version of the framework has built upon those previous to it, and I don't know of any mainstream body of opinion that thinks any version has been a major mistake. Whether you choose MVC or WebForms is a matter of personal taste. My own view would be that MVC is marginally better-suited to the kind of modular development you are planning, but other's mileage may vary...
Take a look at http://umbraco.org/ it's build on ASP.NET MVC and already has the features you want, Umbraco is open source so you can learn allot from it's code base.

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.

Is ASP.NET MVC a good platform?

I aim to try use DevExpress web server controls (which are awesome) in an ASP.NET MVC project (some articles I read on 'net seems to indicate the two can work well together).
I'm eager to start a new project using ASP.NET MVC, and I have been reading up a lot on ASP.NET MVC lately, but I'm not sure if I should invest a project in it. My concern is that it may turn out to be like LINQ to SQL, which is essentially been killed off since MS will not be providing updates.
Is ASP.NET MVC a viable solution to invest in my case?
Yes definitely ASP.NET MVC or any other MVC framework is worth learning. MVC pattern is all about seperation of concerns and helps you to keep your code clean.
If you like Devexpress control too much you could be disappointed because there is no server side control in ASP.NET MVC. But if you want to learn Web's underlying mechanism,HTML, Javascript , clean code, TDD ASP.NET MVC is a good way to go.
Learn first, experiment later
Asp.net MVC is a great development platform for building web applications, so it's definitely worth your time to learn it through and through.
But I suggest you first learn MVC framework and build at least one semi complex app with it and then start experimenting with mixing MVC with web forms controls. It is possible but as much you think you will gain you'll probably loose more. So I would be a bit reluctant and advise you not to match these. At least not on a Greenfield project.
In other words: presumably knowing Asp.net web forms would you suggest someone to heavy use dynamicly created user controls in their web pages if they're just about to learn the technology of Asp.net web forms? Probably not. Or mixing web forms with ASP pages on a greenfield project...
Instead try finding great either MVC-friendly server extensions or client-side libraries that will help you create rich web apps like ExtJS (I don't work for ExtJS llc, but I used the lib on a project in the past and liked it a lot). Using something like this you won't loose stuff from MVC and gain great user experience and rich functionality.
Seeing how you're asking the question on this site, I'd say YES!
DevExpress has a bunch of MVC specialized controls, that use Ajax to get data from the server via callbacks. You can see demos of the controls here:
http://mvc.devexpress.com.
I am not sure if you can use the web forms controls, my understanding is that you can't.
Also, regarding LinqToSql, you don't have to use that. I am using NHibernate for the data layer and it works very nice with MVC.
I worked with asp.net and web forms for more than 5 years and at least 1 year with the DevExpress controls for asp.net, but now I love MVC so much that I think I don't want to go back to the web forms anytime soon.
Hope this helped.

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