Is there a list of the "special" folders and files in ASP.Net MVC? I'm talking about things like "Views/Shared/EditorTemplates" and "Views/_ViewStart.cshtml."
EDIT:
Responding to CodeIgnoto's comment, I'm not asking about general architecture or how to create a site. I want a list of all the "special" folders and files that the ASP.Net MVC uses. There appear to be quite a few poorly documented features of the ASP.Net MVC framework that could be extremely useful. When I stumbled upon the EditorTemplates and DisplayTemplates folders, I was shocked that they weren't really documented anywhere.
I think they should be _Layout.cshtml, App_Codes, App_LocalResosources, App_GlobalResources, Themes, Global.asax, Web.config...
As of June 2013, MSDN has a page on general ASP.NET folders that is relatively complete, but I couldn't find anything more up-to-date than this page for MVC.
My search wasn't exactly extensive, but this document is the most relevant one that is referenced on the official website, so I guess you're right in that something is lacking here.
Unofficial or semi-official information seems to be enough for most people. If you want a definitive reference though, the sources are available.
Related
ASP.NET MVC projects follow naming and folder conventions for Models, Views and Controllers. For other code (ex: Action Filters, Delegating Handlers, etc), is there a best practice as to where to locate these in the project's folder structure?
A good way to find out is by checking out what the actuall best practices are is to see Open Source projects. IIRC the NuGet Gallery was written by the Asp.Net MVC guys, so it would serve as a good example for what they view as Best Practices while still being an actual product:
https://github.com/NuGet/NuGetGallery
It looks like they added their FilterAttributes, HtmlHelpers, etc. to the root of the project : https://github.com/NuGet/NuGetGallery/blob/master/Website/RequireRemoteHttpsAttribute.cs
Also, Phil Haack and David Ebbo worked on the Asp.Net MVC team, and you can check out their GitHub repos for what they like to do.
There is no standard way as such. Different practitioners have put up various methods but all have some pros and cons. However, based on applicable design constraints, here are some pointers :
Reusability
If you want your Action Filters, Delegating Handlers etc to be reusable, then placing them in a dedicated folder in asp.net mvc webroot will do the job. That way all such filters will have global scope and can be used as needed.
Pluggability
If want to create a pluggable module out of the filters etc. It might be worth placing them in a separate DLL altogether. The library can be thought of as a black box which takes all contextual information as function inputs and can be reused as required.
I liked the pluggable architecture of Orchard CMS http://www.orchardproject.net/
I asked a similar question sometime back on how to organize models in asp.net mvc project. Unfortunately didn't get much response.
Models in asp.net mvc 3 areas
I've tried a few google searches and stack over flow searches, but this is proving hard to find than I thought. I need to provide justification to management for our shop to move to ASP.NET MVC 2. The biggest help would be any enterprise level sites or major web development shops that are using ASP.NET MVC 1/2.
Does anyone have a list or link?
I know Stackoverflow uses it, but some stats such as daily views would help too. I found the Jwaala case study here: http://www.microsoft.com/casestudies/case_study_detail.aspx?casestudyid=4000006675 . Aside from that, I'm having some issues finding some professional examples.
Thanks in advance!
Just found a few more case studies:
http://www.microsoft.com/casestudies/Case_Study_Search_Results.aspx?Type=1&Keywords=mvc&LangID=46#top
Could still use more links.
If your management requires a "...but THEY're doing it!!!" justification then you have larger problems.
If you're using the "...but THEY're doing it!!!" justification then you'll likely need much better reasons.
Hate to troll, but just saying that you'll want objective and project-specific reasoning. And if by "management" you mean business-management, then they need to understand that engineering details are best left up to engineering. The Art of War by Sun Tzu is full of advice along these lines.
...and to qualify this, I'm a web-developer working on a partial rewrite of a WebForms app. I'd love to be using MVC for this project, but the actual benefit of doing so doesn't match the cost--business is business after all, and the business-case must be considered.
If you do get stuck with WebForms then you can whip it into shape (what we're doing). With ASP.NET 4.0 (or a little inheritance trickery) you can get rid of the ID renaming; by building ViewModels, domain-objects, and clean Repositories you can avoid a lot of the cruft of WebForms--we have tight, explicit control over what WebForms generates. We've shrunk the actual content of our ASPX pages and their codebehinds by at least an order of magnitude by applying best practices.
Just remember, the tools won't make you a better developer, and unless you know what you're doing or what you're working with then you won't reap the benefits.
Dell is rebuilding its page from ASP.NET Webforms into ASP.NET MVC as Phil Haack is mentioned this on his blog ;)
I can not say if they use MVC 1 or MVC 2.
It seems that MarketWatch use ASP.NET MVC with Spark View Engine as listed here :
http://sparkviewengine.com/spark-in-the-field
http://www.marketwatch.com/
also an e-commerce webiste :
http://www.fancydressoutfitters.co.uk/
Check our sites www.reifen.com and www.bonspneus.fr. They handle pretty big traffic in germany and france.
We have used ASP.NET MVC 1 on these sites and still use (and enjoy) ASP.NET on other sites. Like others said: don't just go with ASP.NET MVC because it is in some way better. It is not. There is allways a situation where I would prefer one or the other.
Additional "live" ASP.NET MVC sites (some broken links)
http://weblogs.asp.net/mikebosch/archive/2008/05/05/gallery-of-live-asp-net-mvc-sites.aspx
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.
I was just curious if any Spark T4 templates already exist that match/are similar to the out of the box web forms view templates (create, edit, details, etc...). My Google skills didn't lead me to any results.
I've translated the mvc2 templates to spark, feel free to copy:
http://guiftp.free.fr/SparkViewTemplates.rar
T4MVC should work fine with Spark. Here is a related forum thread. That being said, I'm not clear from your initial post that T4MVC is the kind of thing you're looking for.
I meant this part of comment ! if it helps...
# re: T4MVC 2.5.01: added support for Html.RenderAction and Html.Action
#spark_guy: I haven't played extensively with the Spark view engine, but I think that T4MVC should work with it just as well as it works with the aspx view engine. If you hit specific issues, please let me know.
YOu can find all the T4MVC posts at http://blogs.msdn.com/davidebb/archive/tags/T4MVC/, though ideally there would be a single posts that describes it all in one place (I'll try to do this). Note that if you download T4MVC, the readme has good 'getting started' info that tells you what it's all about.
I'm curious to know if any basic CMS code has been written for ASP.NET MVC.
The reason I ask is, I'm making a data-driven website for a client, and I've already spent a significant amount of time building it from the ground-up in MVC, but now the client wants content management facilities.
Basically they want to be able to add/edit/remove articles and have revision control.
It would be great if I could somehow 'bolt on' the content management without having to start again from scratch, developing it under an existing CMS.
Should I build the article management and revision control myself, or should I re-use some existing package?
N2 does what you describe - "bolts on" to existing ASP.NET solutions (including MVC).
Also, kooboo is interesting http://www.kooboo.com
(I know this question is old, but it still comes high up for the relevant search terms.)
Today I discovered Meek, http://www.adventuretechgroup.com/labs-meek/, and it was very simple and unobtrusive to add to my MVC project, which I believe is what the original poster would have wanted - bolting on CMS as a feature rather than having it take over your entire site.
Piranha CMS is well suited to bolting on to an existing application. The author of it describes why and how here. To quote straight from that source:
"Our focus is content management and to have a transparent and lightweight API for developers. Piranha CMS has almost no components or helpers that render any HTML at all, it simply provides a database, a manager interface and a routing mechanism for retrieving the correct data for the current request.
In the case of you having an existing website you could actually bypass the routing completely, add one page at a time in the manager interface and then manually load the Page model in you existing page. This would allow you to keep your original application exactly the same but manage the content form the manager interface."
If you are still looking, I've published my new open source CMS here:
MVCwCMS
I'm actively working on it so I will push more updates soon.
Here is also a quick summary as to how Telerik Sitefinity does it:
http://www.sitefinity.com/mvc-cms
in brief - allows you to plug in standard system.web.mvc.controller classes as widgets, lets you use the API for anything including model binding, standard Razor for a view engine etc.
There is also Oxite which I believe is more of a blog engine.
Heve a look at AtomicCms it's a free open source content management system based on ASP.NET MVC 1.0
http://atomiccms.codeplex.com
Check for Orchard ;-)
It is based on asp.net mvc.