Sunday, March 9, 2014

how many types of triggers are there in SQL

There are mainily 3 types of triggers

  1. DML trigger
  2. Instead of trigger written on only view
  3. System trigger
DML trigger written on table that gets fired on dml events like insert or delete or update operation
that trigger may fire 
  1. After DML event 
  2. Before DML event these are timings for trigger firing
Instead of trigger written only on view that view is not modifiable that also gets fired when DML event occurs
System trigger gets fired on system event like before log off or after log on or before shutdown this trigger  may be written on
  1.   Database level
  2.   Schema level
 ---------------------------------------------------------------------------------------------------------
OR you can see as follows
---------------------------------------------------------------------------------------------------------
Based on timing:
1. Before
2. After
3. Instead of
Based on Event:
1. DDL (Insert, update, delete )
2. DML ( Create, alter, analyze, comment )
3. Database ( After setup, before shutdown)
Based on scope of trigger action:
1. Row level
2. Statement level

Wednesday, October 23, 2013

What are Validation Annotations?

Data annotations are attributes you can find in System.ComponentModel.DataAnnotations namespace. These attributes provide server-side validation, and the framework also supports client-side validation when you use one of the attributes on a model property. You can use four attributes in the DataAnnotations namespace to cover common validation scenarios,
Required, String Length, Regular Expression, Range.

http://www.codeproject.com/Articles/639717/MVC-Interview-Questions-and-Answers-All-about-MVC

What is ViewState?

 

For group of views that all use the same layout, this can get a bit redundant and harder to maintain.
The _ViewStart.cshtml page can be used to remove this redundancy. The code within this file is executed before the code in any view placed in the same directory. This file is also recursively applied to any view within a subdirectory.
When we create a default ASP.NET MVC project, we find there is already a _ViewStart .cshtml file in the Views directory. It specifies a default layout:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
Because this code runs before any view, a view can override the Layout property and choose a different one. If a set of views shares common settings, the _ViewStart.cshtml file is a useful place to consolidate these common view settings. If any view needs to override any of the common settings, the view can set those values to another value.

Note: Some of the content has been taken from various sites,books/articles.

What are Scaffold templates?

These templates use the Visual Studio T4 templating system to generate a view based on the model type selected. Scaffolding in ASP.NET MVC can generate the boilerplate code we need for create, read, update, and delete (CRUD) functionality in an application. The scaffolding templates can examine the type definition for, and then generate a controller and the controller’s associated views. The scaffolding knows how to name controllers, how to name views, what code needs to go in each component, and where to place all these pieces in the project for the application to work.

What namespaces MVC use and for what?

What is namespace of ASP.NET MVC?

ASP.NET MVC namespaces as well as classes are located in assembly System.Web.Mvc.
Note: Some of the content has been taken from various books/articles.

What is System.Web.Mvc namespace?

This namespace contains classes and interfaces that support the MVC pattern for ASP.NET Web applications. This namespace includes classes that represent controllers, controller factories, action results, views, partial views, and model binders.

What is System.Web.Mvc.Ajax namespace?

System.Web.Mvc.Ajax namespace contains classes that supports Ajax scripting in an ASP.NET MVC application. The namespace includes support for Ajax scripts and Ajax option settings as well.

What is System.Web.Mvc.Async namespace?

System.Web.Mvc.Async namespace contains classes and interfaces that support asynchronous actions in an ASP.NET MVC application.

What is System.Web.Mvc.Html namespace?

System.Web.Mvc.Html namespace contains classes that help render HTML controls in an MVC application. This namespace includes classes that support forms, input controls, links, partial views, and validation.

http://www.codeproject.com/Articles/639717/MVC-Interview-Questions-and-Answers-All-about-MVC

What are the various types of Application Templates used to create an MVC application?

The various templates are as follows:
  1. The Internet Application template: This contains the beginnings of an MVC web application — enough so that you can run the application immediately after creating it and see a few pages. This template also includes some basic account management functions which run against the ASP.NET Membership.
  2. The Intranet Application template: The Intranet Application template was added as part of the ASP.NET MVC 3 Tools Update. It is similar to the Internet Application template, but the account management functions run against Windows accounts rather than the ASP.NET Membership system.
  3. The Basic template: This template is pretty minimal. It still has the basic folders, CSS, and MVC application infrastructure in place, but no more. Running an application created using the Empty template just gives you an error message. Why use Basic template? The Basic template is intended for experienced MVC developers who want to set up and configure things exactly how they want them.
  4. The Empty template: The Basic template used to be called the Empty template, but developers complained that it wasn’t quite empty enough. With MVC 4, the previous Empty template was renamed Basic, and the new Empty template is about as empty as we can get. It has the assemblies and basic folder structure in place, but that’s about it.
  5. The Mobile Application template: The Mobile Application template is preconfigured with jQuery Mobile to jump-start creating a mobile only website. It includes mobile visual themes, a touch-optimized UI, and support for Ajax navigation.
  6. The Web API template: ASP.NET Web API is a framework for creating HTTP services. The Web API template is similar to the Internet Application template but is streamlined for Web API development. For instance, there is no user account management functionality, as Web API account management is often significantly different from standard MVC account management. Web API functionality is also available in the other MVC project templates, and even in non-MVC project types.

What are the software requirements of ASP.NET MVC4 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.

What are the different Config files in MVC4

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 is Dependency Resolution?

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 filters (locating and injecting filters)
  • Model binders (registering and injecting)
  • Model validation providers (registering and injecting)
  • Model metadata providers (registering and injecting)
  • Value providers (registering and injecting)

What is JSON Binding?

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.