Wednesday, April 28, 2010

Caching in ASP.NET

If you want to improve performance of your ASP.NET application, then caching is the obvious choice.

Retrieving data/resources outside application takes more processing steps, more time and consumption of many resources in the server. ie, request will have to go to the server and server may have to contact a sql server for details.

consider if the data/resource readily available in the browser. This saves time, and eliminates many processing steps and result is high performance.

this technique of temporarily storing page output/ application data in client/server is called as caching

Caching can be implemented in 3 different ways:

  1. output caching
  2. fragment caching
  3. data caching

output caching - entire asp.net page can be cached. So that page don't have to re-create everytime and this results in fast loading of web page

fragment caching - part of asp.net page is cached and this part is loaded fast. @ OutputCache directive can be used for caching

data caching - caching application data improves the performance. Cache object allows to add any object to the cache. It is stored as key value pair.

Reference:

http://authors.aspalliance.com/aspxtreme/webapps/aspcachingfeatures.aspx

Tuesday, April 27, 2010

delegate & multicast delegate

Delegate is like function pointer.

  • Delegate used to invokes a function.
  • Multicast delegate used to invoke more than one function.

class demo
    {
        // delegates are used to invoke function
        delegate int mathdelegate(int a, int b);
        
        public demo()
        {
            mathdelegate objDelegate = new mathdelegate(this.add);
            int result = objDelegate(10, 20);
            Console.WriteLine(result);


            //multicast delegates are used to invoke more than one function
            objDelegate += new mathdelegate(sub);
            result = objDelegate(30, 10);
            Console.WriteLine(result);

            objDelegate += new mathdelegate(mul);
            result = objDelegate(30, 10);
            Console.WriteLine(result);

            
        }

        public int add(int a, int b)
        {
            return a + b;
        }

        public int sub(int a, int b)
        {
            return a - b;
        }

        public int mul(int a, int b)
        {
            return a * b;
        }
    }

Friday, April 23, 2010

outlook object model overview

Accessing Objects in an Outlook Project


--------------------------------------------------------------------------------



Outlook provides many objects with which you can interact. To use the object model effectively, you should be familiar with the following top-level objects:



•Application



•Explorer



•Inspector



•MAPIFolder



•MailItem



•AppointmentItem



•TaskItem



•ContactItem



Application Object

The Application object represents the Outlook application, and it is the highest-level object in the Outlook object model. Some of the most important members of this object include:



•The CreateItem method which you can use to create a new item such as an e-mail message, task, or appointment.



•The Explorers property, which you can use to access the windows that display the contents of a folder in the Outlook user interface (UI).



•The Inspectors property, which you can use to access the windows that display the contents of a single item, such as an e-mail message or meeting request.



To get an instance of the Application object, use the Application field of the ThisAddIn class in your project. For more information, see Programming Application-Level Add-Ins.



Note

To help avoid security warnings when you use properties and methods that are blocked by the Outlook object model guard, get Outlook objects from the Application field of the ThisAddIn class. For more information, see Specific Security Considerations for Office Solutions.





Explorer Object

The Explorer object represents a window that displays the contents of a folder that contains items such as e-mail messages, tasks, or appointments. The Explorer object includes methods and properties that you can use to modify the window, and events that are raised when the window changes.



To get an Explorer object, do one of the following:



•Use the Explorers property of the Application object to access all of the Explorer objects in Outlook.



•Use the ActiveExplorer method of the Application object to get the Explorer that currently has focus.



•Use the GetExplorer method of the MAPIFolder object to get the Explorer for the current folder.



Inspector Object

The Inspector object represents a window that displays a single item such as an e-mail message, task, or appointment. The Inspector object includes methods and properties that you can use to modify the window, and events that are raised when the window changes.



To get an Inspector object, do one of the following:



•Use the Inspectors property of the Application object to access all of the Inspector objects in Outlook.



•Use the ActiveInspector method of the Application object to get the Inspector that currently has focus.



•Use the GetInspector method of a specific item, such as a MailItem or AppointmentItem, to retrieve the Inspector that is associated with it.



MAPIFolder Object

The MAPIFolder object represents a folder that contains e-mail messages, contacts, tasks, and other items. Outlook provides 16 default MAPIFolder objects.



The default MAPIFolder objects are defined by the OlDefaultFolders enumeration values. For example,



Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox corresponds to the Inbox folder in Outlook.



For an example that shows how to access a default MAPIFolder and create a new MAPIFolder, see How to: Create Custom Folder Items.



MailItem Object

The MailItem object represents an e-mail message. MailItem objects are usually in folders, such as Inbox, Sent Items, and Outbox. MailItem exposes properties and methods that can be used to create and send e-mail messages.



For an example that shows how to create an e-mail message, see How to: Create an E-Mail Item.



AppointmentItem Object

The AppointmentItem object represents a meeting, a one-time appointment, or a recurring appointment or meeting in the Calendar folder. The AppointmentItem object includes methods that perform actions such as responding to or forwarding meeting requests, and properties that specify meeting details such as the location and time.



For an example that shows how to create an appointment, see How to: Create a Meeting Request.



TaskItem Object

The TaskItem object represents a task to be performed within a specified time frame. TaskItem objects are located in the Tasks folder.



To create a task, use the CreateItem method of the Application object, and pass in the value olTaskItem for the parameter.



ContactItem Object

The ContactItemobject represents a contact in the Contacts folder. ContactItem objects contain a variety of contact information for the people they represent, such as street addresses, e-mail addresses, and phone numbers.



For an example that shows how to create a new contact, see How to: Add an Entry to Outlook Contacts. For an example that shows how to search for an existing contact, see How to: Search for a Specific Contact.



Using the Outlook Object Model Documentation

--------------------------------------------------------------------------------



For information about the objects you can use in the Outlook object model, see the following sets of documentation:



•Welcome to the Outlook 2007 Primary Interop Assembly Reference



•Welcome to the Microsoft Office Outlook 2007 Developer Reference



•Welcome to the Microsoft Office Outlook 2003 VBA Language Reference



The first link provides information about the classes and interfaces in the primary interop assembly for Outlook. The other links provide information about the Outlook object model as it is exposed to Visual Basic for Applications (VBA) code. Each set of documentation has advantages and disadvantages for developers who are using Office development tools in Visual Studio.



Primary Interop Assembly Reference

This documentation describes all of the types in the Outlook primary interop assembly that you can use in Office projects:



•It describes the types in the primary interop assembly for Outlook 2007.



•It does not provide any code examples at this time.

 
 
http://msdn.microsoft.com/en-us/library/ms268893.aspx