Showing posts with label MVC3. Show all posts
Showing posts with label MVC3. Show all posts

Wednesday, 11 March 2015

ASP.NET MVC VERSIONS AND DIFFRENCES Or Diffrence Between ASP.NET MVC2 and MVC3 and MVC4 and MVC5

Microsoft ASP.NET MVC VERSIONS AND DIFFRENCES

MVC Release History
The Current Version of ASP.NET MVC is 4 and it was released on 15th Aug 2012. ASP.NET MVC is packaged with Visual Studio 2012 and MVC can be installed for Visual Studio 2010. Below We have mentioned the release history of ASP.NET MVC.
Date
Version
10 Dec 07
ASP.NET MVC CTP
13 Mar 09 
ASP.NET MVC 1.0
16 Dec 09
ASP.NET MVC 2 RC
04 Feb 10
ASP.NET MVC 2 RC 2
10 Mar 10
ASP.NET MVC 2
06 Oct 10
ASP.NET MVC 3 Beta
09 Nov 10
ASP.NET MVC 3 RC
10 Dec 10
ASP.NET MVC 3 RC 2
13 Jan 11
ASP.NET MVC 3
20 Sep 11
ASP.NET MVC 4 Developer Preview
15 Feb 12
ASP.NET MVC 4 Beta
31 May 12
ASP.NET MVC 4 RC
15 Aug 12
ASP.NET MVC 4
30 May 13
ASP.NET MVC 4 4.0.30506.0 
26 Jun 13
ASP.NET MVC 5 Preview
23 Aug 13
ASP.NET MVC 5 RC 1
17 Oct 13
ASP.NET MVC 5
17 Jan 14
ASP.NET MVC 5.1
10 Feb 14
ASP.NET MVC 5.1.1
4 Apr 14
ASP.NET MVC 5.1.2
27 May 14
ASP.NET MVC 5.2.0 Rc
01 Jul 14
ASP.NET MVC 5.2.0
23 Aug 14
ASP.NET MVC 5.2.2-Rc
Date
Version 
10 Dec 07
ASP.NET MVC CTP
13 Mar 09 
ASP.NET MVC 1.0
16 Dec 09
ASP.NET MVC 2 RC
In this ASP.NET MVC tutorial, we will have a quick look into new and important features introduced in major versions of Microsoft ASP.NET MVC starting from MVC 3 to MVC 5 (the latest one so far).
ASP.NET MVC 2
§  MVC2 uses only Web Forms View Engine(.aspx) as a default View Engine.
§  Chart, WebGrid , Crypto, WebImage, WebMail Contolrs not available
§  (HTML syntax) Web Forms View Engine synatax : <%=Html code %>
§  It’s Support only Master Pages only not Layout Pages.
ASP.NET MVC 3
§  New Project Templates having support for HTML 5 and CSS 3.
§  Improved Model validation.
§  Razor View Engine introduced with a bundle of new features.
§  Having support for Multiple View Engines i.e. Web Forms view engine, Razor or open source.
§  Controller improvements like ViewBag property and ActionResults Types etc.
§  Unobtrusive JavaScript approach.
§  Improved Dependency Injection with new IDependencyResolver.
§  Partial page output caching.
ASP.NET MVC 4
§  ASP.NET Web API, a framework that simplifies the creation of HTTP services and serving a wide range of clients. Follow to create your first ASP.NET Web API service.
§  Adaptive rendering and other look-n-feel improvements to Default Project Templates.
§  A truly Empty Project Template.
§  Based on jQuery Mobile, new Mobile Project Template introduced.
§  Support for adding controller to other project folders also.
§  Task Support for Asynchronous Controllers and Asynchronous Methods.
§  Controlling Bundling and Minification through web.config.
§  Support for OAuth and OpenID logins using DotNetOpenAuth library.
§  Support for Windows Azure SDK 1.6 and new releases.
§  Refreshed and modernized default project template.
§  Recipes to customize code generation.
§  In Razor view engine new features added like Condition attribute and ‘Tlide slash’ i.e URL Resolution.
ASP.NET MVC 5
§  Creating your first ASP.NET MVC 5 Application in 4 simple steps
§  Bootstrap replaced the default MVC template.
§  ASP.NET Identity for authentication and identity management.
§  Authentication Filters for authenticating user by custom or third-party authentication provider.
§  With the help of Filter overrides, we can now override filters on a method or controller.
§  Attribute Routing is now integrated into MVC 5.
ASP.NET MVC6 | ASP.NET vNext
§  Single Programming Model for ASP.NET MVC and ASP.NET Web API.
§  Optimized for Cloud Computing.
§  Supporting side by side deployment of runtime and framework along with application.
§  Out of the box support for dependency injection.
§  vNext is Open Source and supports running on multiple platforms including Linux and Mac.
§  New JSON-based project Extension.
§  In order to dynamically compile code, Roslyn compiler is used.
§  MVC 6 added new cloud computing optimization system of MVC , web API, SignalR and entity framework.
§  The Microsoft  make a bundle of MVC, Web API, WebPages, SignalR , That bundle we called MVC 6.
§  In MVC 6, Microsoft removed the dependency of system.web.dll from MVC 6  because it's so expensive. Typically  it consume 30K memory per request/response.
§  Right now, in MVC 6 consume 2K  memory per request response. It's too small memory  consume.
§  Most of the problem solved using the Roslyn Compiler.
§  The ASP .Net  vNext used the Roslyn Compiler,  By using Roslyn compiler do not need to compile the application Its  compile automatically the application code.
§  The .Net vNext is a cross platform and open source.
§  The .Net vNext has the new project extension project.json. Basically project.json contain the all dependency dll of the application.
§  In MVC 5.1 and 5.2 support to Enum and EnumHelper in  razor views.

Hopefully, this article will help you in comparing core features of ASP.NET MVC in different versions.

Sunday, 14 July 2013

ASP.NET MVC 4: Display modes For mobile iphone desktop webapplication


One new features of ASP.NET MVC 4 is support for display modes. This means that you can conditionally show different output to different user agents like desktop and mobile browsers. Of course, you can define your own custom rules too. In this posting I will show you how display modes work and explain how to use them in your ASP.NET MVC applications.

User Agent Switcher for Firefox

If you don’t have access to your computer from mobile device you can use User Agent Switcher add-on for Firefox. This add-on allows you to change user-agent string so your Firefox identifies itself as a browser you say for web servers.
Firefox: User Agent Switcher
User Agent Switcher is set to identify Firefox as iPhone 3.0. You can change settings
and add more user-agent strings if you like. The add-on is free to use.
Now let’s get to real business.

Creating mobile view

Create new ASP.NET MVC 4 internet application and leave it as it is created by Visual Studio. We will create now one special view for all mobile devices to show how ASP.NET MVC 4 uses display modes.
Now create new view and name it as Home.mobile.cshtml. Take the code here using copy and paste to get it to your new mobile view.

@{     ViewBag.Title = "Home Page Mobile"; } <h2>@ViewBag.Message</h2> <p>     To learn more about ASP.NET MVC visit <a href=http://asp.net/mvc  title="ASP.NET MVC Website">http://asp.net/mvc</a>. </p> <ul data-role="listview" data-inset="true">     <li data-role="list-divider">Navigation</li>     <li>@Html.ActionLink("About", "About", "Home")</li>     <li>@Html.ActionLink("Contact", "Contact", "Home")</li> </ul>
Now run your project from Visual Studio and take a look at the page as it is shown in your default web browser. Run Firefox, make it identify itself as iPhone and open same URL in it. You should see the following page.
ASP.NET MVC 4: Displaying mobile page using display modes
What happened? ASP.NET detected Firefox as iPhone. Based on settings in browser capabilities file ASP.NET takes iPhone as mobile device. Now ASP.NET MVC 4 uses this information to detect the correct view. If there is view that has string “.mobile” before file extension ASP.NET MVC 4 uses this view. If such view is not found then default view is used instead.

Creating custom display mode rules

When you are targeting wider range of mobile devices or other user agents then you usually face incompatibility problems that different user agents of same type may have. By example, not all mobile web browsers support CSS fully and for older and poorer mobile web browsers you should create special primitive views. Of course, there are also devices like smart phone browsers that are very powerful and you may want to use some UI parts to use some specific features of these browsers.
You can define your own display mode rules in Application_Start method of Global.asax. Here is one simple example taken from release notes.

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);

    DisplayModes.Modes.Insert(0, new DefaultDisplayMode("iPhone")
    {
        ContextCondition = (context => context.Request.UserAgent.IndexOf
            ("iPhone", StringComparison.OrdinalIgnoreCase) >= 0)
    });
}

Of course, now we need also additional view for iPhone. Add new view for Home controller to your project and name it as Home.iPhone.cshtml. My test view has the following contents.

@{     ViewBag.Title = "Home Page iPhone";
}
<h2>Welcome to iPhone page</h2>
<p>@ViewBag.Message</p>
<ul data-role="listview" data-inset="true">
    <li data-role="list-divider">Navigation</li>
    <li>@Html.ActionLink("About", "About", "Home")</li>
    <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul
>
After running your project and opening it in Firefox you should see something like this.
ASP.NET MVC 4: Displaying iPhone page using display modes
Now we have also separate view for iPhone. We inserted new rule as first one to the display mode rules so before ASP.NET applies mobile devices rule to requests made from iPhone our rule will be detected and applied.

Conclusion

Display modes support in ASP.NET MVC 4 provides us with powerful feature to support different user agents and keeping our project clean at same time. If you create views for different user agents and these views support same type of model then you will have less code in your controllers and views that are not messy and full of different rendering logic. What is the best thing – display modes support is flexible and extensible like many other parts of ASP.NET MVC framework.

Sunday, 26 May 2013

Introduction of MVC

Prerequisites
 
Knowledge of some other programming language ( Basic , C++ , C#, Any language ).

Installed In Your PC .
 
* Visual Studio 2010 or Visual Studio Web Developer 2012 Express
* MS Sql Server 2005 or MS Sql Server 2005 Express or 2008
* IIS or IIS Express
* MVC3
* Web Platform Installer Not Necessary But nice to have.  










About Microsoft ASP .NET MVC 


MVC or Model View Controller is a design pattern. This design pattern has been present in software applications for several decades. The Model View Controller pattern was invented in a Smalltalk context for decoupling the graphical interface of an application from the code that actually does the work.
* Model-Consist of Application data and the business rules. It contains the code to manipulate the data ( From Database or any datasource) & Also the Objects that retrive the data. It represent the state of   particular aspect of the application. Eg Model Maps to Database Table and entries in table   represent the state of the application.Model is responsible for actual data processing, like database connection, querying database, implementing business rules etc. It feeds data to the view without worrying about the actual formatting and look and feel.
* Controller- Handles user interation, Reads data from view, Controls Input & Send input data to the model. Handles Inputs and update the model to reflect the change in state of the   application. It also pass information to the view . Controller is responsible for Notice of action. Controller responds to the mouse or keyboard input to command model and view to change. Controllers are associated with views. User interaction triggers the events to change the model, which in turn calls some methods of model to update its state to notify other registered views to refresh their display.
* View-Is an output , It could be a webpage or a printout . In short views are used to display the data. Most of the time we create views from the model data. It accepts information from the   controller and displays it. View is the graphical data presentation (outputting) irrespective of the real data processing. View is the responsible for look and feel, some custom formatting, sorting etc. View is completely isolated from actual complex data operations.


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
What U Need To Learn
 
* HTML
* CSS
* JQuery
  > JQuery UI
  > JQueryTemplates ( Transform JSON into HTML Markup )


 
 
Advantages of MVC?
 
1. Separation of Concerns
2. Better Support For Test Driven Development
3. Clean URL 
4. Better For Search Engine Optimization
5. Full Control Over the User Interface or the HTML 
6. Loosely Coupled so Each Component can be tested independently. 
 
 
Hello World Application 


           "Hello World" Application
          
          
          
Lets start with a hello world application to make sure that we have everything in place to get started & the code executes .



Lets start with your first mvc application "Hello World"

Step 1 : Start Visual Studio





Step 2 : Create a new Project









Step 3 : Change ViewBag.Message To "Hello World"



Step 4 : Run the Application



Here You go : Your First "Hello World" MVC Application




Now that you got your application to run , You have everything in place to start learning asp .net MVC.