Skip to main content

Posts

Showing posts from June, 2015

Asp.Net MVC Life Cycle

MVC Life Cycle: 1. Routing -         Routing is the first step in ASP.NET MVC pipeline. Typically, it is a pattern matching system that matches the incoming request to the registered URL patterns in the Route Table. The UrlRoutingModule(System.Web.Routing.UrlRoutingModule) is a class which matches an incoming HTTP request to a registered route pattern in the RouteTable(System.Web.Routing.RouteTable). 2.Controller Initialization -        The MvcHandler initiates the real processing inside ASP.NET MVC pipeline by using ProcessRequest method. This method uses the IControllerFactory instance (default is System.Web.Mvc.DefaultControllerFactory) to create corresponding controller. 3. Action Execution – Action execution occurs in the following steps:        When the controller is initialized, the controller calls its own InvokeAction() method by passing the details of the chosen action method. This is han...

Steps to attach DataBase to .Net Application - App_Data folder.

Step 1: Detach Database from SQL Server.          i) Open Sql Server          ii) Login to Server          iii) Select the DB that you going to attach to application, and right click for the option to detach the DB. Step 2: Right click on app_data folder and click on add existing item and then select database which you want to add in app_data folder,DB will exist in C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\...  Step 3: Alter the your connection string as below: <connectionstrings> <add connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DBName.mdf;Integrated Security=True;User Instance=True  " name="ConnectionName" providername="System.Data.SqlClient" /> </connectionstrings>

Reference Links

Collection Class : http://geekswithblogs.net/BlackRabbitCoder/archive/2011/06/16/c.net-fundamentals-choosing-the-right-collection-class.aspx http://www.codeproject.com/Tips/574576/How-to-implement-a-custom-IPrincipal-in-ASP-NET-MV MVC Methods corresponding to events that fire on each request: http://www.dotnetcurry.com/ShowArticle.aspx?ID=126 http://www.codeproject.com/Articles/650240/A-Simple-Action-Filter-Overview \ Exception Handling in MVC: http://www.codeproject.com/Articles/850062/Exception-handling-in-ASP-NET-MVC-methods-explaine Entity Framework Optimistic and Pessimistic: http://www.codeproject.com/Articles/114262/ways-of-doing-locking-in-NET-Pessimistic-and-opt WCF  SSL Confiduration Video: http://www.screencast.com/users/Shivkoi/folders/Default/media/92f7f313-9b1f-47f9-b99e-b9e098263da3

Books To Refer

1. C#   in Depth ,  Third   Edition : Foreword   by Eric   Lippert        By:  Jon Skeet    Publication Date:  16-SEP-2013 2. Learning jQuery - Fourth Edition     B y:  Jonathan Chaffer; Karl Swedberg     Pub. Date:  June 25, 2013      3.Beginning JSON                    By:  Ben Smith     Publication Date:  04-MAR-2014 4. Responsive Web Design with jQuery     By:  Gilberto Crespo      Pub. Date:  November 25, 2013 5. Developing Responsive Web Applications with AJAX and jQuery       By:  Sandeep Kumar Patel  P ub. Date:  July 25, 2014 6. Dependency Injection in .NET     by  Mark Seemann

OOPS Concepts with Real Time Example

Abstract Class Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods. Let's look at an example of an abstract class, and an abstract method. Example:- Suppose we were modeling the behavior of animals, by creating a class hierachy that started with a base class called Animal. Animals are capable of doing different things like flying, digging and walking, but there are some common operations as well like eating and sleeping. Some common operations are performed by all animals, but in a different way as well. When an operation is performed in a different way, it is a good candidate for an abstract method (forcing subclasses to provide a custom implementation). Let's look at a very primitive Animal base class, which defines an abstract method for making a sound (s...

.Net Questions

Questions to recall:- 1) what is framework 2) CLR? 3) IL 4) Garbage collection 5) Stack 6) Heap 7) Abstract class 8) Interface 9) Should inheriting class need to implement all the methods from the Interface? 10) Should inheriting class need to implement all the methods from the Abstract class? 11) JavaScript? 12) JQuery? 13) == vs === in JavaScript? 14) select all div 's using jQuery? 15) can I replace $ alias with my own symbol? Answer:Yes,example:-var item=jQuery.noConflict(); then use item instead of $. 16) how to know whether page has been loaded using jQuery? 17) how many document. Ready functions can be written in a single page? 18) Steps to query db. & load Grid view with data using ADO.NET? 19) create one cuss class & bind to div? 20) read textbox value using JQuery? 21) Inner join 22) Group by 23) Having 24) Increase all the employees salary by 100 rest (update query?) 25) MVC? Lifecycle? 26) Using keyword? 2...

C# IEnumerable and IQueryable

The first important point to remember is IQueryable interface inherits from IEnumerable, so whatever IEnumerable can do, IQueryable can also do.   There are many differences but let us discuss about the one big difference which makes the biggest difference. IEnumerable interface is useful when your collection is loaded using LINQ or Entity framework and you want to apply filter on the collection. Consider the below simple code which uses IEnumerable with entity framework. It’s using a Wherefilter to get records whose EmpId is 2. EmpEntities ent = new EmpEntities(); IEnumerable<Employee> emp = ent.Employees;  IEnumerable<Employee> temp = emp.Where(x => x.Empid == 2).ToList<Employee>(); This where filter is executed on the client side where the IEnumerable code is. In other words all the data is fetched from the database and then at the client its scans and gets the record with EmpId is 2.   But now see the below code we have...