Very Good article for understanding MVC Code First Migrations
This ubiquitous trifecta represents MVC almost perfectly.
The HTML is the "skeleton" of bedrock content. Text that communicates information to the reader.
The CSS adds visual style to the content. It is the "skin" that we use to flesh out our skeleton and give it a particular look. We can swap in different skins via CSS without altering the original content in any way. They are relatively, but not completely, independent.
So if you believe the web has been at all successful — most signs I’ve seen point to yes — then you also have to acknowledge the incredible power of Model-View-Controller.
Tips on using Virtual Directories in ASP.NET, MVC, HttpSimulator, SiteMap
Imagine you develop a web-site. You register IIS site to test it, seems like all is ok. You deploy it to customer, and… oh no! where is my images, styles, scripts? and why site map causes an exception?!
It is common situation when site developed and tested on IIS web-site root, and deployed into Virtual Directory. Here I want to describe some tips to avoid such situations.
Creating AJAX based CRUD tables using ASP.NET MVC 3 and the jTable jQuery plug-in.
Using a ViewModel Pattern
The ViewData dictionary approach has the benefit of being fairly fast and easy to implement. Some developers don’t like using string-based dictionaries, though, since typos can lead to errors that will not be caught at compile-time. The un-typed ViewData dictionary also requires using the "as" operator or casting when using a strongly-typed language like C# in a view template.
An alternative approach that we could use is one often referred to as the "ViewModel" pattern. When using this pattern we create strongly-typed classes that are optimized for our specific view scenarios, and which expose properties for the dynamic values/content needed by our view templates. Our controller classes can then populate and pass these view-optimized classes to our view template to use. This enables type-safety, compile-time checking, and editor intellisense within view templates.
Razor is designed to be an alternate view engine for ASP.NET MVC. Initially introduced in WebMatrix and now shipped as part of ASP.NET MVC 3 Beta, Razor allows developers to replace the clunky <% %> syntax with a much cleaner coding model mainly around the sign @. Moreover, it provides some excellent features for Master Page scenarios, while at the same time you won’t lose access to any features you are already familiar with, such as HTML helper methods.
Since MVC has been released I have observed much confusion about how best to construct view models. Sometimes this confusion is not without good reason since there does not seem to be a ton of information out there on best practice recommendations. Additionally, there is not a “one size fits all” solution that acts as the silver bullet. In this post, I’ll describe a few of the main patterns that have emerged and the pros/cons of each. It is important to note that many of these patterns have emerged from people solving real-world issues.
My app stopped posting changes to data. The Save method in my controller wasn’t even hit on a JQuery post. What I discovered is that I can’t have two “Save” methods in the same controller, even when they have different signatures. Renamed one of them and all is good.