Archive for the '.NET Framework' Category
Visual Studio 2008 SP1 Features
Introduction
Visual Studio 2008 service pack 1(SP1) and .NET Framework 3.5 SP1 offers the developers to develop rapid,responsiveness and stable applications. It allows the developers to develop applications that optimized for windows vista, SQL server, MS 2007 office system and the web.
Features Overview
- WPF Designers
- SQL Server 2008 support
- ADO.NET Entity Designer
- TFS enhancements
- Performance enhancements
You can download the Visual Studio 2008 SP1.
Note: When you are installing Visual Studio 2008 on Windows Vista it fails the installation.
To Resolve this issue
1. Right-click the Sidebar icon in the notification area, at the far right of the taskbar.
2. Click "Exit".
WCF Sample in Visual studio 2008
Introduction
This post explains the procedure to develop the sample WCF Service and WCF Client in Visual studio 2008. Get an overview on WCF and WCF Terms.
1. Start open Visual studio 2008, Select new project option from file menu
2. Select the WCF ServiceApplication template from the project templates.
3. WCF Service describes the operations that perform in a service contract.
4.Declare the service contract in Iservice.cs interface and implement in the above Service class.
5. To test this service, you will need to create a client and use it to call the
service. You can do this using the svcutil.exe tool from the command line with
the following syntax: Generating a client using svcutil.
svcutil.exe http://localhost:53391/Service.svc?wsdl
6. The above command generates a code file and configuration file contains the client class. Add the two files to your client application and use the generated client class to call the service.
7. Client class which call the service looks like
8. The generated client configuration file looks like
9. The service configuration file looks like
Conclusion
The above post explains shows the standard way to create a service and client and calling the service. The Next posts explains each feature in depth.
3 commentsOverview of .NET Remoting
Introduction
This post provides you the overview of .NET Remoting Framework. It allows the objects to interact with one another across the application domains.
Features
- Communication channels for transporting messages across applications
- Formatters are used for encoding and decoding the messages. supported formatters are
1. Binary encoding formatter – use when performance is critical
2. XML encoding formatter = use when Interoperability is essential
- Object activation and life-time support
Object activation model falls into two categories
1.Client-activated objects
2.Server-activated objects
Remote Objects
An object is consider to be remote when the caller of the object is in different application domain. Object has to decorate with [serializable] custom attribute or they have to implement ISerializable interface to be considered as a remote. Remote objects have to be passed by value. Any object can be changed to remote by deriving from MarshalByRefObject.
Proxy Objects
Proxy Objects are created when client activates a remote object. Proxy object acts as a representative to remote object and ensures that all calls that made on proxy are forwarded to the remote object.
Two types of Proxy Objects
1.Transparent Proxy
2.Real Proxy
when client activates a remote object, Framework creates a local instance of TransparentProxy class. All method calls on Transparent Proxy object are intercepted by CLR and forwards the call if the remote object is in same application domain.
Real Proxy object calls are intercepted by CLR and forwards the call even the remote object is in different application domain by calling its Invoke method.
2 commentsRemoting in .NET Framework 2.0
Introduction
Remoting is distributed application technology built in the Framework 2.0 with new features which allows the developer to build wide range of distributed applications. Overview of Remoting.
Introduced some new features in Remoting in .NET FW 20. The applications are now more secured and performanent.
Enhancement in the Channel infrastructure: The new channel IPC is introduced which enables the same box communication. It allows the communication between both server application and client application when both are in the same machine. This wont use any network layer when client and server communicate. IPC Channel is based on named pipes.
IPC channel don’t use ports unlike TCP and HTTP channels. The URI will look like ipc://test/server.rem.
.NET FW 2.0 supports three channels in communication – TCP,HTTP and IPC and it supports two formatters, Binary and SOAP.
.NET Remoting Server application can be in the following forms
- Console application
- Windows application
- Windows Service
- IIS(using HTTP and Binary Formatter)
Interface Implementation in Server Application
Client Application
Application Configuration file settings
We can limit the number of users by using this channel.
1 commentService Model Metadata Utility Tool
The Service Model Metadata Utility Tool is used to generate service model code from metadata documents.
The following command generates client code from a running service or online metadata documents.
svcutil http://service/metadataEndpoint
The following command generates client code from local metadata documents.
svcutil *.wsdl *.xsd /language:c#
The following command downloads metadata documents from running services.
svcutil /t:metadata http://service/metadataEndpoint
The following command generates metadata documents for service contracts and associated types in an assembly.
svcutil myAssembly.dll
2 commentsWCF Terms
The following are the terms used in WCF
Message
A message contains data which consist of body and headers.
Service
A service is a construct which exposes one or more endpoints. Each endpoint exposing one or more service operations.
Endpoint
Endpoint contains a location (an address) that defines where messages can be sent, a specification of communication mechanism(a binding) that describes how messages should be sent.
Address
An address specifies the location where messages are received. It is specified as a URI.
Service operation
A service operation is a procedure defines in a services’s code that implements the functionality for an operation. This operation is exposed to clients as methods on a WCF client.
Hosting Process
A service must be hosted in some process which include IIS, WAS(windows activation service) and windows services.
WCF Client
A WCF client is client-application that exposes the service operations as methods.A WCF client can be automatically generated by using the ServiceModel Metadata Utility Tool (Svcutil.exe) and pointing it at a running service that publishes metadata.
2 commentsWindows Communication Foundation
Introduction
WCF provides a common platform for all .NET communication between the applications.Using WCF we can develop ASMX, Remoting and COM+ Applications.It allows the developers to work distributed applications.
WCF is a runtime and contains set of API’s for creating applications that send messages between services and clients.
Messages and Endpoints
WCF based on message-based communication, we can model HTTP request or MSMQ message as Message.
Messages are sent between endpoints. Endpoints are places where where messages are sent or received. WCF programming model consist of clients and services. Clients are applications that initiate communication and services which are applications that wait for clients to communicate with them and respond to that communication.
Single application act as both a client and a service.
An endpoint defines where messages should be sent, how they should be sent and what the messages should look like. A service can expose this information as metadata to clients.
Protocols
Messages can be sent over intranets and Internet using HTTP and TCP.
WCF provides the following encodings:
- Text encoding
- Message Transmission Optimization Mechanism(MTOM) encoding
- Binary encoding
Message patterns
supports message patterns including
- request-reply
- one-way
- duplex
WCF terms article can refereed for more information on WCF.
1 commentLINQ Architecture
Introduction
Language-Integrated Query (LINQ) is a new feature introduced in visual studio 2008 and .NET Framework 3.5. Developers can write the queries in the code to retrieve the data from various types of data sources like SQL,XML and XQuery.
Earlier developers has to learn the syntax for writing queries for each data source. LINQ simplifies by offering a model to work with the data across various kinds of data sources.
LINQ Architecture
By using LINQ you can query and transform the data in
- XML Document
- SQL Databases
- ADO.NET Datasets
- .NET Collections
LINQ Query operation contains three parts
1. Obtain the data source.
2. Create the Query.
3. Execute the Query.
LINQ Example
class LINQExample
{
static void Main()
{
// The Three Parts of a LINQ Query:
// 1. Data source.
string[] names = new string[4] { “TOM”, “DAN”, “ADAMS”, “BERNARD” };
// 2. Query creation.
// nameQuery is an IEnumerable<string>
var nameQuery =
from name in names
where name == “TOM”
select name;
// 3. Query execution.
foreach (int name in nameQuery)
{
Console.Write("{0,1} ", name);
}
}
}
Important thing to notice is when write a query it do not retrieve any data. In order to get the data from data source you need to execute the query.
The data source in the above example is Array and implicitly supports IEnumerable interface. All types that support IEnumerable<T> are called queryable types.
Query expression contains three clauses from, where and select.
The from clause specifies the data source, where clause applies the filter and select clause specifies the types of returned elements.
Query executes in foreach statement in the example. The actual execution of the query starts when iterate over the query variable in foreach statement.
Forcing Immediate Execution
Queries that perform aggregate operations must first iterate over those elements. Example Count, Max and Average.
These execute without an explicit foreach statement.
int nameCount = nameQuery .Count();
1 comment
.NET Framework Features
.NET Framework 1.1/2.0/3.0/3.5 main features comparision
1.1
Side-by-Side Execution
ASP.NET Mobile Controls
IPv6 Support
2.0
64-Bit Platform Support
Click-Once Deployment
Strongly-Typed Application Settings
No comments