Saturday 7 July 2012

Migrating ASP.NET Web Services to WCF

Migrating ASP.NET Web Services to WCF


Migration is a key issue in existing applications and many a times we get confused as to what to do and how to in migration related tasks. Some of the key points of the MSDN migration article are as follows:

WCF has several important advantages relative to ASP.NET Web services. While ASP.NET Web services tools are solely for building Web services, WCF provides tools that can be used when software entities must be made to communicate with one another. This will reduce the number of technologies that developers are required to know in order to accommodate different software communication scenarios, which in turn will reduce the cost of software development resources, as well as the time to complete software development projects.

Even for Web service development projects, WCF supports more Web service protocols than ASP.NET Web services support. These additional protocols provide for more sophisticated solutions involving, amongst other things, reliable sessions and transactions.

WCF supports more protocols for transporting messages than ASP.NET Web services. ASP.NET Web services only support sending messages by using the Hypertext Transfer Protocol (HTTP). WCF supports sending messages by using HTTP, as well as the Transmission Control Protocol (TCP), named pipes, and Microsoft Message Queuing (MSMQ). More important, WCF can be extended to support additional transport protocols. Therefore, software developed using WCF can be adapted to work together with a wider variety of other software, thereby increasing the potential return on the investment.

WCF provides much richer facilities for deploying and managing applications than ASP.NET Web services provides. In addition to a configuration system, which ASP.NET also has, WCF offers a configuration editor, activity tracing from senders to receivers and back through any number of intermediaries, a trace viewer, message logging, a vast number of performance counters, and support for Windows Management Instrumentation.
Given these potential benefits of WCF relative to ASP.NET Web services, if you are using, or are considering using ASP.NET Web services you have several options:
  • Continue to use ASP.NET Web services, and forego the benefits proffered by WCF.
  • Keep using ASP.NET Web services with the intention of adopting WCF at some time in the future. The topics in this section explain how to maximize the prospects for being able to use new ASP.NET Web service applications together with future WCF applications. The topics in this section also explain how to build new ASP.NET Web services so as to make it easier to migrate them to WCF. However, if securing the services is important, or reliability or transaction assurances are required, or if custom management facilities will have to be constructed, then it is a better option to adopt WCF. WCF is designed for precisely such scenarios.
  • Adopt WCF for new development, while continuing to maintain your existing ASP.NET Web service applications. This choice is very likely the optimal one. It yields the benefits of WCF, while sparing the cost of modifying the existing applications to use it. In this scenario, new WCF applications can co-exist with existing ASP.NET applications. New WCF applications will be able to use existing ASP.NET Web services, and WCF can be used to program new operational capabilities into existing ASP.NET applications by virtue of WCF ASP.NET compatibility mode.
  • Adopt WCF and migrate existing ASP.NET Web service applications to WCF. You may choose this option to enhance the existing applications with features provided by WCF, or to reproduce the functionality of existing ASP.NET Web services within new, more powerful WCF applications.
Happy Programming ! !
If you have any query mail me to Sujeet.bhujbal@gmail.com     
Regards
Sujeet Bhujbal
-----------------------------------------------------------
---------------------------------------------------------------

Choosing the Right Collection Class


Choosing the Right Collection Class

In .net we have number of collection classes that are very useful in managing collections of object. But the question is which one should we use to get the best performance. The answer is that what is the scenario and the output that one requires from the collection, depending on which the selection of the collection type should be made. The following table explains the basic parameters for collections that should be kept in mind while selection the type of collection.


Collection
Ordered?
Contiguous Storage?
Direct Access?
Lookup Efficiency
Notes
Dictionary
No
Yes
Via Key
Key:
O(1)
Best for high performance lookups.
Sorted
Dictionary
Yes No Via Key Key:
O(log n)
Compromise of Dictionary speed and ordering, uses binary search tree.
SortedList
Yes
Yes
Via Key
Key:
O(log n)
Very similar to SortedDictionary, except tree is implemented in an array, so has faster lookup on preloaded data, but slower loads.
List
No
Yes
Via Index
Index: O(1)
Value: O(n)
Best for smaller lists where direct access required and no ordering.
LinkedList
No
No
No
Value:
O(n)
Best for lists where inserting/deleting in middle is common and no direct access required.
HashSet
No
Yes
Via Key
Key:
O(1)
Unique unordered collection, like a Dictionary except key and value are same object.
SortedSet
Yes
No
Via Key
Key:
O(log n)
Unique ordered collection, like SortedDictionary except key and value are same object.
Stack
No
Yes
Only Top
Top: O(1)
Essentially same as List except only process as LIFO
Queue
No
Yes
Only Front
Front: O(1)
Essentially same as List except only process as FIFO

Happy Programming ! !
If you have any query mail me to Sujeet.bhujbal@gmail.com     
Regards
Sujeet Bhujbal
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------