Feeds:
Posts
Comments

What is Message Queue ?

Sending messages in a message queuing scenario is much like sending a letter through the mail. With message queuing there is a sending and receiving application. With message queuing you drop your message in a message queue and expect the message to be delivered. In a message queuing scenario, if your network is overloaded your message takes a bit longer to get delivered. If the receiving application does not become available within a preset timeout period, the message is rerouted to a dead-letter queue. MSMQ guarantees 100 percent delivery. 

There are two basic kinds of queues: public and private. A public queue is registered in Active Directory and as such can be discovered by browsing the network. A private queue is created on a machine and can only be accessed from another machine if you know the exact name of the machine and queue. Private queues are usually used if operating in Windows workgroup mode or if the queue is meant to connect two applications running on the same machine. In workgroup mode, private queues are the only option, but even in domain mode, consider the following advantages of using private queues: 

·         Private queues have all the features of public queues except that private queues are not listed in Active Directory and are not discoverable. If you know the queue is available, you can still connect remotely.

  ·         Private queues are faster to create than public queues because they require no extra time for Active Directory activity.

  ·         Private queues do not cause Active Directory replication problems.            

   Queue Type Description Syntax

Queue Type

Description Syntax
Public queue Registered in directory services, can be located by any message queuing applications MachineName \QueueName
Private queue Registered on local machine, typically cannot be located by other applications MachineName\Private$ \QueueName
Journal queue Contains removed messages, queue specific (if enabled) MachineName \QueueName\Journal$
Machine journal queue Contains removed messages, machine wide (if enabled) MachineName\Journal$
Machine dead-letter queue Contains undeliverable messages (if enables) MachineName\Deadletter$
Machine transactional Contains undeliverable MachineName
dead-letter queue transactional messages (if enabled) \XactDeadletter$

Value Types

The simplest types in the .NET Framework, primarily numeric and Boolean types, arevalue types. Value types are variables that contain their data directly instead of containing a reference to the data stored elsewhere in memory. Instances of value types are stored in an area of memory called the stack, where the runtime can create, read, update, and remove them quickly with minimal overhead.

There are three general value types:

  •  Built-in types

  •  User-defined types

  •  Enumerations

Each of these types is derived from the System.Value base type.

Built-in Value Types

Built-in types are base types provided with the .NET Framework, with which othertypes are built. All built-in numeric types are value types. You choose a numeric typebased on the size of the values you expect to work with and the level of precision you require. 

Type Forwarding

Type forwarding is an attribute (implemented in TypeForwardedTo) that allows you to move a type from one assembly (assembly A) into another assembly (assembly B), and to do so in such a way that it is not necessary to recompile clients that consume assembly A. After a component (assembly) ships and is being used by client applications, you can use type forwarding to move a type from the component (assembly) into another assembly and ship the updated component (and any additional assemblies required), and the client applications will still work without being recompiled.

Type forwarding works only for components referenced by existing applications. When you rebuild an application, there must be appropriate assembly references for any types used in the application.

To move a type from one class library to another, follow these steps:

  • Add a TypeForwardedTo attribute to the source class library assembly.

  • Cut the type definition from the source class library.

  • Paste the type definition into the destination class library.

  • Rebuild both libraries. The following code shows the attribute declaration used to move TypeA to the DestLibclass library:‘ VBImports System.Runtime.CompilerServices

    <Assembly:TypeForwardedTo(GetType(DestLib.TypeA))]>

    // C#

    using System.Runtime.CompilerServices;

    [assembly:TypeForwardedTo(typeof(DestLib.TypeA))] 

Generics

Generics are part of the .NET Framework’s type system that allows you to define a type while leaving some details unspecified. Instead of specifying the types of parameters or member classes, you can allow code that uses your type to specify it. This allows consumer code to tailor your type to its own specific needs.

The .NET Framework version 2.0 includes several generic classes in the System.Collections. Generic namespace, including Dictionary, Queue,SortedDictionary, and SortedList. These classes work similarly to their nongeneric counterparts in System.Collections, but they offer improved performance and type safety.

Generics offer two significant advantages over using the Object class:

  • Reduced run-time errors:  The compiler cannot detect type errors when you cast to and from the Object class. For example, if you cast a string to an Object class and then attempt to cast that Object to an integer, the compiler will not catch the error. Instead, the runtime will throw an exception. Using generics allows the compiler to catch this type of bug before your program runs. Additionally, you can specify constraints to limit the classes used in a generic, enabling the compiler to detect an incompatible type.

  • Improved performance: Casting requires boxing and unboxing, which steals processor time and slows performance. Using generics doesn’t require casting or boxing, which improves run-time performance.

The new membership features in ASP.NET 2.0 simplify user management in these ways:

  • They automatically create a data store. When you attempt to use membership features, ASP.NET 2.0 checks whether the specified data store is configured. If it is not, ASP.NET creates it.
  • They include server controls for creating and validating users and displaying user- specific information and login status. New controls such as the Login, LoginStatus, CreateUserWizard, and ChangePassword controls provide pre-built user-interface building blocks, including functionality for the most common membership-related tasks. These controls are highlighted in the New Web Controls application.
  • They provide an application programming interface (API) for programmatically manag- ing users. The Membership API is accessed via the Membership class and includes help- ful methods such as CreateUser, DeleteUser, and ValidateUser.

With ASP.NET 2.0 Membership, you can actually create a Web site with protected pages, automatic redirects to a login page, user creation (registration), and user login without writing any code.

Partial Classes Concept in Asp.Net 2.0
One of the language enhancements in .NET 2.0 – available to both VB2005 and C# 2.0 programmersis support for partial classes. In a nutshell, partial classes mean that your class definition can be split into multiple physical files. Logically, partial classes do not make any difference to the compiler. During compile time, it simply groups all the various partial classes and treats them as a single entity.

 Benefits of Partial Classes
One of the greatest benefits of partial classes is that they allow a clean separation of business logic and the user interface (in particular, the code that is generated by the Visual Studio Designer). Using partial classes, the UI code can be hidden from the developer, who usually has no need to access it anyway. Partial classes also make debugging easier, as the code is partitioned into separate files. This feature also helps members of large development teams work on their pieces of a project in separate physical files.