Monday, August 9, 2010

The MessageParameter Attribute

The MessageParameter Attribute


The MessageParameter Attribute also defined in the System.ServiceModel namespace, controls how the names of any operation parameters and return values appear in the service description, that is, how they are emitted as part of the WSDL for the service. This attribute has only one property, the Name property.

One concrete case in which this attribute can be useful is when you need to have a .NET keyword or type name for the name of the XML element that is serialized at the wire-level transport layer.

Eg:

[OperationContract]
int Display(
[MessageParameter(Name="int")]
int a);

The OperationContract Attribute

The OperationContract Attribute:


The OperationContract Attribute, also defined in the System.ServiceModel namespace, can be applied only to methods. It is used to declare the method as belonging to a Service contract.

As with the ServiceContractAttribute, the OperationContractAttribute can be declared with a variety of named parameters that provide control over the service description and message formats.

• Name Specifies a different name for the operation instead of using the default, which is the method name.

Eg:
[OperationContract]
int Add(int a, int b);

Service Contracts and Service Types

Service Contracts and Service Types:


The ServiceContractAttribute, defined in the System.ServiceModel namespace, can be applied to either .NET interfaces or .NET classes. It is used to declare the type as a Service contract.

The Service Contract attribute enables the WCF runtime to generate a description for the service.

The ServiceContractAttribute can be declared without any parameters, but it can also take named parameters.

• Name: Specifies a different name for the contract instead of the default, which is simply the interface or class type name. This contract name is what will appear in the portType name when consumers access the WSDL.

• Namespace Specifies a target namespace in the WSDL for the service. The default namespace is http://tempuri.org.

Eg:

[ServiceContract(Name="MathService")]
public interface IService1
{
}

Sunday, August 8, 2010

Introduction to WCF | Inter-Process Communications Technologies

Inter-Process Communications Technologies:


Networking solutions enabled PCs to be able to communicate with each other. Inter-Process Communications Technologies are:

1. COM

2. DCOM

3. COM+

4. .NET FRAMEWORK

Microsoft originally designed COM to enable communications between components and applications running on the same computer.

COM was followed by DCOM (distributed COM), enabling applications to access components running on other computers over a network.

DCOM was itself followed by COM+. COM+ incorporated features such as integration with Microsoft Transaction Server, enabling applications to group operations on components together into transactions so that the results of these operations could either be made permanent (committed) if they were all successful, or automatically undone (rolled back) if some sort of error occurred. COM+ provided additional capabilities, such as automatic resource management (for example, if a component connects to a database, you can ensure that the connection is closed when the application finishes using the component), and asynchronous operations (useful if an application makes a request to a component that can take a long time to fulfill; the application can continue processing, and the component can alert the application by sending it a message when the operation has completed).

COM+ was followed in turn by the .NET Framework, which further extended the features available and renamed the technology as Enterprise Services. The .NET Framework also provided several new technologies for building networked components. One example was Remoting, which enabled a client application to access a remote object hosted by a remote server application as though it was running locally, inside the client application.

The Web Services

Technologies such as COM, DCOM, COM+, Enterprise Services, and .NET Framework Remoting all work well when applications and components are running within the same local area network inside an organization.

A Web service is an application or component that executes on the computer hosting the Web site rather than the user’s computer. A Web  service can receive requests from applications running on the user’s computer, perform operations on the computer hosting the Web service, and send a response back to the application running on the user’s computer. A Web service can also invoke operations in other Web services, hosted elsewhere on the Internet. These are global, distributed applications.

WCF ( Windows Communication Foundation)

The purpose of WCF is to provide a unified programming model for many of technologies (Web Services, COM, Remoting, MSMQ etc..), enabling you to build applications that are as independent as possible from the underlying mechanism being used to connect services and applications together.

Introduction to Silverlight

Silverlight


Silverlight is Microsoft’s implementation of a cross-browser, cross-platform client framework that allows designers and developers to deliver Rich Internet Applications (RIA) embedded in Web pages OR Silverlight is Microsoft's new browser-based plug-in for delivering richer interactive applications to users over the web.

Silverlight applications are implemented as embedded objects in Web pages. When the browser encounters a Silverlight object in the Web page, the plug-in downloads an XAP package from the Web server that contains the binaries and resources for the Silverlight application and then begins code execution inside the Web page.

The Silverlight framework allows applications to access Web services, databases, Web servers, and other data sources to acquire data that is displayed in the UI. It also allows the application to integrate with the Web page DOM as well as AJAX and JavaScript to enhance the functionality of the Web page.

Comparing Silverlight 1.0 and Silverlight 2.0

The difference between Silverlight 1.0 and 2 is very significant. The biggest change is the implementation of the .NET framework. If you are familiar with Silverlight 1.0 then you will be used to coding the application functionality in JavaScript. You still can implement functionality using JavaScript; however, you can now also implement functionality using C#, Visual Basic, Python, Ruby, and managed JavaScript.

Another major change is the introduction of the XAP package. In Silverlight 1.0, the XAML code was referenced directly by the Silverlight object embedded in the browser. In Silverlight 2, however, the embedded object references an XAP package that contains the XAP file, assemblies, and resources necessary to run the Silverlight application.

Silverlight applications are built from two code bases — XAML and managed code. The managed code can be written in C#, Visual Basic, JavaScript, or any of the Dynamic Language Runtime (DLR) languages. The common code in all Silverlight applications is XAML. You use XAML code in Silverlight to create the visual elements that make up the UI. XAML provides a robust set of controls that allow you to create rich, professional-looking UI very rapidly

Understanding and using server controls

understanding and using server controls


An ASP.NET server control is a control that provides both user functionality and programmability through a server-side event model. For example, a Button control allows users to trigger an action, such as indicating they have completed a task. In addition, the Button control is posted back to the server where ASP.NET is able to match the control with its associated event code (an on-click event, for instance). The server controls that ship with ASP.NET allow you to write code against a well-defined object model. In fact, all server controls, including the Web page class itself, inherit from the System.Web.UI.Control class.

There are two primary types of server controls in ASP.NET: HTML and Web. The HTML controls provide server-side processing that generally maps back to an HTML input element like a text box or submit button. The Web controls are ASP.NET controls that focus more on their object model and less on their HTML rendering aspects.