Thursday, February 3, 2011

Interface

An Interface is not a class. It is an entity that is defined by the word Interface . An Interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to abstract class it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one Interface but can only inherit from oneabstract class. Since C# doesn't support multiple inheritance, Interface are used to implement multiple inheritance.

Abstract Class

An absrract class is a special kind of class that cannot be instantiated. So the question is why we need a class   that cannot be instantiated? An absrract class  is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

How can exception be handled with out the use of try catch?

using Exception Management application block
or
Page_error
Application_error objects

Caching

In a very simple term caching is process of storing data in memory, frequently used data which is very costly to reproduce, is kept in a memory and re used. One of the ways to improve the throughput is to use caching in web pages. Caching is a tried and tested technique for performance improvement. HTML pages have been cached to improve the speed. An indirect example of caching could be connection pooling. 

ASP.Net supports caching the Asp.net response page that is generated by requests and also storing individual objects in memory. 

Three type of Caching in Asp.net
  • Page Output Caching ·

  • Page Fragment Caching

  • Data Caching


  • Delete Items from CacheItems are deleted from cache when the expiration is set or when the dependency file changes or when the server needs to free memory.


     Cache.Remove("oString");

    Monday, January 31, 2011

    3-tier architecture.

    We generally split our application into 3-Layers1)Presentation Layer ( Where we keep all web forms Master Pages and User Controls).
    2)Business Layer (Where we keep business logic). e.g Code related to manipulating data Custom Exception classes Custom Control classes Login related code if any etc. etc.
    3)Data Access Layer (Where we keep code used to interact with DB). e.g. We can have the methods which are using SQL Helper (Application Block).

    Events occur when a page is loaded

    Below are the events occures during page load.
    1) Page_PreInit
    2) Page_Init
    3) Page_InitComplete
    4) Page_PreLoad 

    Life cycle of an ASP .NET page

    Following are the events occur during ASP.NET Page Life Cycle:

    1)Page_PreInit
    2)Page_Init
    3)Page_InitComplete
    4)Page_PreLoad
    5)Page_Load
    6)Control Events
    7)Page_LoadComplete
    8)Page_PreRender
    9)SaveViewState
    10)Page_Render
    11)Page_Unload