Should I use App_Themes or Content/themes in MVC4? - asp.net-mvc-3

Up until now I had been using MVC3 for my apps but with the new update of Visual Studio 2012 I got MVC4. I migrated a few of my apps and now they are broken.
I noticed that the new project template for an Internet application creates a ~/Content/themes/base folder.
And yet, up until now I had been accustomed to use the App_Themes folder for that. In fact, with VS.2013 you can use "Add ASP.NET FOlder | Themes".
So I am now confused with MVC4, has It deprecated the App_Themes folder (which seems more appropriate to me than ~/Content) ? or is there a significant difference?

App_Theme come from ASP.NET Platform and one goal of mvc is get a clean html code
One of the things that ASP.NET MVC is missing is the ability to
easily implement Themes. The older, more mature standard ASP.NET
framework includes theme support via the App_Themes folder; however
limited it can be, it’s still more than ASP.NET MVC currently has.
Well, at least until I wrote this little custom ViewEngine and
ControllerBase class to help out and allow us to very easily implement
Themes within our ASP.NET MVC applications
take a look this helpful article this link

Related

Is Areas for ASP.NET Core the same as Portable Areas?

I've seen references dating back 3+ years for Portable Areas in ASP.NET MVC, but then I ran across "Areas" for ASP.NET Core.
Are these the same thing?
Side question:
Is this something that is better solved with DI if you want to create an application with modularity or plugins?
Using the ASP.NET Core Application parts feature you can easily put your area's controllers/view components inside another project and then use in the main web application. It is a bit more difficult with the views and static content. I prefer to add them as resources in the same projects as area controllers are located and then implement the IFileProvider interface and assign my implementation to the IHostingEnvironment.WebRootFileProvider property.
You can use ExtCore framework to make this all automatically.

How to override and localize client-side validation messages for ASP.NET MVC 4?

I've created custom validators with localized strings which are loaded from my satellite resource assemblies. Now I want to override default MVC messages like "{0} must be a number".
In this article:
http://martinnormark.com/asp-net-mvc-localize-numeric-data-val-number-validation
the author says
I was browsing through the source code of ASP.NET MVC 4, and found a
changeset that looks like will fix this issue. In short, it will be
possible to define your own ResourceClassKey, and the MVC framework
will use that before using default error messages. Nice!
So I started looking how to use the new features but most of solutions seem outdated and don't work or maybe I'm doing something wrong.
How do I override client side error messages in MVC 4 using resource dll files?
Does MVC itself always decide which resource assembly to pick or I can somehow force it to pick the one I need for a specific language?
Somehow this article
http://www.codeproject.com/Articles/42168/Localizing-ASP-NET-MVC
did not appear in my earlier searches.
The key point was to add the App_GlobalResources folder manually and move resource assemblies there, and only then it picked up our custom messages.
For some reason the App_GlobalResources folder is missing when creating MVC 4 app in Visual Studio 2012 so we assumed that it is not needed any more. But when digging through the MVC source code, we found that MVC is using HttpContext.GetGlobalResourceObject which looks in App_GlobalResources. Oh, Microsoft, come on, why are you doing this... we spent three days looking for various complex solutions just because you threw out that folder from the latest MVC version.

Missing Single Page Application template in MVC4 RC

When I installed MVC4 beta on a development PC, it had a template for SPA (Single Page Application). Today on a different PC with the same setup (VS2010 SP1, win7), I installed MVC4 RC but no longer is the SPA template available (see image). Any one else having this issue? or is this a documented change that I could not find?
Changes from ASP.NET MVC 4 Beta
The major changes from ASP.NET MVC 4 Beta in this release are summarized below:
Removed ASP.NET Single Page Application: ASP.NET Single Page Application (SPA) shipped with ASP.NET MVC 4 Beta as an early preview of the experience for building applications that include significant client-side interactions using JavaScript. SPA won’t ship with the final MVC 4 release, but will continue to evolve outside of the MVC 4 release. Check out the ASP.NET SPA home page for details.
...
http://www.asp.net/whitepapers/mvc4-release-notes
P.S., Wow I am glad that I didn't use it for an app I build right now. I was considering it 3 months ago, but decided not to risk it because MS said that it is experimental.
You can get the SPA template in the Fall 2012 update. More information on the template here and here.
It`s very risky now
For example if you try to run it with System.json for serialization it runs well with WebApi and DBDATAContext methods but it`s impossible to use it with Entities relationship entity circular errors and so on. (There is a solution to change private access of method get, but would be too much work to have to change in all the access methos of all your entities.

Sitecore and MVC3

I am starting a project with Sitecore, I have looked for different possibilities. I have some experience with MVC but I don't understand why you want to combine this with Sitecore (6.4).
What are the benefits? Are there any examples of the implementation of (the code of) this (not the configuration on: http://sdn.sitecore.net/upload/sitecore6/64/integrating%20an%20asp.net%20mvc%20web%20application%20in%20sitecore%20cms-usletter.pdf)?
Or why shouldn't I use MVC with Sitecore?
So when should I use Sitecore 6.4 with MVC3 and when not? And are there any (code)examples?
Thanks in advance!
I've successfully implemented my own MVP implementation using Sitecore. MVP is a bit more forgiving than MVC, and can easily be integrated into web forms based applications. I used T4 templates to generate Models directly from Sitecore templates using the built-in webservices which worked really well.
Sitecore doesn't support MVC yet (in the recommended release), and trying to make it work is probably not worth the effort. I believe they are working on a version that supports MVC properly, which may be the link you provided. However it's probably also very new and there is a lot of functionality in the old version that relies on web forms. I'd like to see it working under MVC in an official capacity for a few more iterations.
Implementing patterns such as MVC and MVP are all about separating concerns and making your presentation layer unit testable. It also encourages more elegant design.
Just reading the doc it looks like this is a guide for running Sitecore in parallel with MVC. I can't see anything about new rendering mechanisms for Sitecore, which would make templating difficult in anything other than web forms. It would however allow you to use the Sitecore API to build your own templates via MVC Views, but you would loose the inline editing functionality that you get out-of-the-box with web forms.
Using mvp is probably the simplest way to go. I wrote a blog post about it here.
However, we have used MVC3 with Razor before and it worked very well. The only issue is you lose the ability to use Page edit mode as you have to do some hacking of sitecore to get it to work. I'm contemplating writing a blog post about it if people are interested.
Just to follow up.. MVC is now supported in 6.6, which will be released on November 5th 2012. We just saw a demo from John West at the Sitecore Symposium and it looks like a great framework. One of the best things about it is that you can use MVC side-by-side with Web Forms. You don't have to make an all-in bet for MVC, you can just slowly migrate or build new components in MVC, while still running Web Forms throughout your site.

MVC 1.0 Compatibility with VS 2010

We are planning to upgrade our technology to VS 2010. But I wonder if the MVC 2.0 is working properly since it has many issues raised from software developer who used it please see here: http://aspnet.codeplex.com/releases/view/41742.I want to use MVC 1.0 in VS 2010 is it compatible?
Indeed as Robaticus said, MVC2 works well and you shouldn't be afraid to use it... but if you really want to stick with MVC 1.0, take the relevant MVC DLLs and copy them into a known lib folder, and then directly link your project to those. By doing this, you will be directly linking to the old MVC libraries which will still work just fine. Just don't link to any of the MVC 2.0 libraries that will undoubtedly be sitting in the Global Assembly Cache.
MVC 2 works great; I'm using it right now. There are some very slight changes to the signature of some framework components, but overall works great. Would recommend 2 because they have a lot of new features to take advantage of and make your life easier.
If you had to, MVC 1 and MVC 2 they give you the source code, which you can include and use in your project, so you are always covered there.
MVC 1 and MVC 2 are compiled in .NET 3.5 SP 1 version, so you may be able to use the MVC 1 DLL directly...
HTH.

Resources