Sunday, 15 February 2015

MVC Interview Questions and Module -2

What is JSON Binding?
MVC 3 included JavaScript Object Notation (JSON) binding support via the new
JsonValueProviderFactory, enabling the action methods to accept and model-bind data in JSON format. This is especially useful in advanced Ajax scenarios like client templates and data binding that need to post data back to the server.

What is Dependency Resolution?
MVC 3 introduced a new concept called a dependency resolver, which greatly simplified the use of dependency injection in your applications. This made it easier to decouple application components, making them more configurable and easier to test.
Support was added for the following scenarios:

·                           Controllers (registering and injecting controller factories, injecting controllers)
·                           Views (registering and injecting view engines, injecting dependencies into view pages)
·                           Action fi lters (locating and injecting fi lters)
·                           Model binders (registering and injecting)
·                           Model validation providers (registering and injecting)
·                           Model metadata providers (registering and injecting)
·                           Value providers (registering and injecting)

What are Display Modes in MVC4?
Display modes use a convention-based approach to allow selecting different views based on the browser making the request. The default view engine fi rst looks for views with names ending with .Mobile.cshtml when the browser’s user agent indicates a known mobile device. For example, if we have a generic view titled Index.cshtml and a mobile view titled Index.Mobile.cshtml, MVC 4 will automatically use the mobile view when viewed in a mobile browser.
Additionally, we can register your own custom device modes that will be based on your own custom criteria — all in just one code statement. For example, to register a WinPhone device mode that would serve views ending with .WinPhone.cshtml to Windows Phone devices, you’d use the following code in the Application_Start method of your Global.asax:

DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("WinPhone")
{
ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf
("Windows Phone OS", StringComparison.OrdinalIgnoreCase) >= 0)
});

What is AuthConfig.cs in MVC4?
AuthConfig.cs  is used to configure security settings, including sites for OAuth login.

 What is BundleConfig.cs in MVC4?
 BundleConfig.cs in MVC4 is used to register bundles used by the bundling and minification
 system. Several bundles are added by default, including jQuery, jQueryUI, jQuery  validation, Modernizr, and default CSS references.

 What is FilterConfig.cs in MVC4?
 This is used to register global MVC filters. The only filter registered by default is the    HandleErrorAttribute, but this is a great place to put other filter registrations.

 What is  RouteConfig.cs in MVC4?
 RouteConfig.cs holds the granddaddy of the MVC config statements, Route configuration.

 What is WebApiConfig.cs in MVC4?
 Used to register Web API routes, as well as set any additional Web API configuration settings.

What’s new in adding controller in MVC4 application?
Previously(in MVC3 and MVC2), the Visual Studio Add Controller menu item only displayed when we right-clicked on the Controllers folder. However, the use of the Controllers folder was purely for organization. (MVC will recognize any class that implements the IController interface as a Controller, regardless of its location in your application.) The MVC 4 Visual Studio tooling has been modified to display the Add Controller menu item for any folder in your MVC project. This allows us to organize your controllers however you would like, perhaps separating them into logical groups or separating MVC and Web API controllers.

What are the software requirements of ASP.NET MVC 4 application?
MVC 4 runs on the following Windows client operating systems:

·                         Windows XP
·                         Windows Vista
·                         Windows 7
·                         Windows 8
It runs on the following server operating systems:

·                         Windows Server 2003
·                         Windows Server 2008
·                         Windows Server 2008 R2
MVC 4 development tooling is included with Visual Studio 2012 and can be installed on Visual
Studio 2010 SP1/Visual Web Developer 2010 Express SP1.


0 comments:

Post a Comment