Jul 28, 2010

Backgroundworker threads

Backgroundworker threads

The BackgroundWorker class is a component in Windows Forms applications that can be used for task which take some time. Task will be run in a dedicated thread (asynchr). You can drag de background wordker from the compenent tab in the toolbox on to the form.
In a triggered method, create the events if the thread has to be created. Implement 3 events. The work event, the completed event and de progress changed event. This does not trigger the thread, but only implements the functionality
private void InitializeBackgoundWorker()
{
backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler( backgroundWorker1_RunWorkerCompleted);
backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler( backgroundWorker1_ProgressChanged);
}
Example implementation DoWork event:
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
e.Result = DoLongWork((int)e.Argument, worker, e);
}
The sender is de background worker. The eventargs contain the option for cancelling the operation. The worker object tells abut the status. The user could have choosen to cancel the operation. If the consuming time function is executing. The worker status can be questionned along the way. A user could have choosen the cancel the operation.
if (worker.CancellationPending) { e.Cancel = true; }
With the function backgroundWorker1.CancelAsync(); the thread can be cancelled.With the function backgroundWorker1.RunWorkerAsync(numberToCompute); the thread can be started.

After completing or cancelling the thread the Completed event will be triggered
private void backgroundWorker1_RunWorkerCompleted( object sender, RunWorkerCompletedEventArgs e) { }
The eventargs contains the result.
e has attribute error. The e.Error can be set in the DoWork event
e has attribute cancelled. The e.Cancelled can be set in the DoWork event
e has attribute result. Also can be set in the DoWork event.
In the DoWork event the progress can be reported. Call worker.ReportProgress(percentComplete);
In the event handler of ProgessChanged read the value:
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
textBoxCompleted.Text = e.ProgressPercentage.ToString() + "% completed";
}

Jul 19, 2010

DevExpress Win Form XGrid Set focus on editied column

how to set focus on edition column on click on add

   If GridView2.DataRowCount = 0 Then
            GridView2.FocusedColumn = GridView2.VisibleColumns(0)
            GridView2.SetFocusedValue(0)
            additem()
        End If

Jul 6, 2010

Filter ListBox using javascript

<head id="Head1" runat="server">
  <title>Demotitle>
head>
<script type="text/javascript" language="javascript">
  var myVals=new Array();
   function CacheValues()
   {
   var l =  document.getElementById('ListBox1');
 
   for (var i=0; i < l.options.length; i++)
    {
      myVals[i] = l.options[i].text;
    }
   }
 
  function SearchList()
  {
    var l =  document.getElementById('ListBox1');
    var tb = document.getElementById('TextBox1');
   
    l.options.length=0;
 
    if(tb.value == "")
    {
      for (var i=0; i < myVals.length; i++)
      {
        l.options[l.options.length] = new Option(myVals[i]);
      }
    }
    else{
 
      for (var i=0; i
      {
        if (myVals[i].toLowerCase().indexOf(tb.value.toLowerCase()) != -1)
        {
          l.options[l.options.length] = new Option(myVals[i]);
        }
        else
        {
          // do nothing
        }
      }
    }
  }
  function ClearSelection(lb)
  {
    lb.selectedIndex = -1;
  }
 
<body onload=CacheValues();>
  <form id="form1" runat="server">
  <input type="text" ID="TextBox1" onkeyup="return SearchList();"/><br />
  <select ID="ListBox1" Height="150px" Width="250px"  size="13" multiple="multiple">
  <option>Vincentoption>
  <option>Jenniferoption>
  <option>Shynneoption>
  <option>Christianoption>
  <option>Helenoption>
  <option>Vladioption>
  <option>Beeoption>
  <option>Jeromeoption>
  <option>Vinzoption>
  <option>Churchilloption>
  <option>Rodoption>
  <option>Markoption>
  select>
  form>
body>
html>
 

Jun 16, 2010

Update Panel With Dynamic Controls

I am dynamically adding DropDownLists to a table cell. When a DropDownList's selection is changed, I want to update a value ("Label1") on the screen. This value is contained within the Updatepanel ("UP1"). (The DropDownLists are created based on values from a database.) When I create each DropDownList, I also add it to the for the UpdatePanel. This allow the UpdatePanel to be redrawn when the values in the DropDownLists change.

In the example, when I change the selectedvalue in the DropDownList, the "Label1" value on the screen is correctly changed each time but only the 1st, 3rd, 5th, etc. change results in an AsyncPostback. The 2nd, 4th, 6th, etc. results in a full postback. It seems to me that on the 2nd, 4th, etc. occurrence, the UpdatePanel has somehow lost it's (during the last AsyncPostback). When a full postback occurs, everything is reset so that's why it works again the next time.

I know I need to re-add the dynamic trigger to the UpdatePanel, but I don't really know where I should add them.

Thanks for any help you might be able to provide.








Current Value:




Public currentValue As Integer = 0

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim tr As New TableRow
Dim tc As New TableCell
Dim DDL As New DropDownList
DDL.Items.Add(New ListItem("Item #1", 1))
DDL.Items.Add(New ListItem("Item #2", 2))
DDL.ID = "DDL"
DDL.AutoPostBack = True
AddHandler DDL.SelectedIndexChanged, AddressOf SelectionChanged
Dim asyncTrigger As New AsyncPostBackTrigger
asyncTrigger.ControlID = "DDL"
asyncTrigger.EventName = "SelectedIndexChanged"
UP1.Triggers.Add(asyncTrigger)
tc.Controls.Add(DDL)
tr.Cells.Add(tc)
Table1.Rows.Add(tr)
End Sub

Protected Sub SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim thisDDL As DropDownList = CType(sender, DropDownList)
If ViewState("CurrentValue") = "" Then
currentValue = 0
Else
currentValue = CInt(ViewState("CurrentValue"))
End If
currentValue += thisDDL.SelectedValue
ViewState("CurrentValue") = CStr(currentValue)
Label1.Text = CStr(currentValue)
End Sub

Programmatically adding triggers to an UpdatePanel - Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions

If you want to add a control to fire the UpdatePanel, you have to add the trigger. You add this through the ScriptManager control. The method is .RegisterAsyncPostBackControl(ControlName);

I put this call in the Page_PreInit() method.

Jun 8, 2010

Integrate Youtube in ASP.NET

    I will discuss how to integrate youtube video in asp.net. Youtube provides the API to access the its huge database of videos. It also provides search facility and customized player for integration.
       First thing you need is to get developer key for accessing youtube service. You can get it from here. Once you get the developer you can use the API URL to retrieve youtube videos. The URL is,
   1: http://www.youtube.com/api2_rest
Fig – (1) Youtube API URL
       There specific parameters that you need to pass in query string to get desire result from youtube. See the list below,
   1: Parameter    Description
   2: =============================================================================================
   3: method       youtube.videos.list_by_tag (only needed as an explicit parameter for REST calls)
   4: dev_id       Your developer ID .
   5: tag          Search keyword
   6: page         The "page number" of results you want to retrieve (e.g. 1, 2, 3)
   7: per_page     The number of results you want to retrieve per page (default 20, maximum 100)
Fig – (2) Parameters for youtube querystring
       So from fig – (1) and (2) if you need to search video for asp.net and you need 10 records per page and page should display 3rd page the the URL will be,
   1: http://www.youtube.com/api2_rest?method=youtube.videos.list_by_tag&dev_id=YOURDEVELOPERID&tag=asp.net&page=3&per_page=10
   2:  
Fig – (3) Querystring for youtube video
      Use page=-1 and per_page=-1 to display all the videos on same page without paging. You will get reply in XML format from this URL. You can retrieve that XML as XML document and use XQuery to to get the desire result. OR you can generate dataset from that XML using ReadXML method. I have used ReadXML method.
      This will create three tables (1) ut_response , (2) video_list and (3) video. in dataset. ut_response table contains the information whether the supplied DeveloperId is correct? If yes, the status field contains “ok”. video_list contains total number of videos returned. video table contains the information about the videos.
   1: private void GetYoutubeVedio()
   2: {      
   3:         
   4:         StringBuilder stbURL = new StringBuilder("http://www.youtube.com/api2_rest?");
   5:         stbURL.Append("method=youtube.videos.list_by_tag");
   6:         stbURL.Append("&dev_id=" + DEVELOPERKEY);
   7:         stbURL.Append("&tag=" + txtSearch.Text.Trim());
   8:         stbURL.Append("&page=-1&per_page=-1"); // you can add custom paging if desired
   9:         
  10:         DataSet ds = new DataSet();
  11:         ds.ReadXml(stbURL.ToString());
  12:  
  13:         dlYoutube.DataSource = ds.Tables[2];
  14:         dlYoutube.DataBind();
  15:         
  16:         
  17: }
Fig – (4)  Function to retrieve youtube video in ASP.NET
     You can retrieve youtube videos using above function in ASP.NET. Youtube also provides player integration details.
      Lets have a look at the code below. This code displays all youtube videos played in same asp.net page.
   1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="GetYouTubeVedios.aspx.cs"
   2:     Inherits="Youtube_GetYouTubeVedios" %>
   3:  
   4: "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   5: "http://www.w3.org/1999/xhtml">
   6: "server">
   7:     Get Youtube Vedios
   8: 
   9: 
  10:     
  17: 
  18:     
"form1" runat="server">
  19:         
  20:             
  21:                 
  22:                     
  25:                 
  26:                 
  27:                     
  31:                 
  32:                 
  33:                     
  38:                 
  39:                 
  40:                     
  43:                 
  44:                 
  45:                     
 100:                 
 101:             
  23:                         Sample application to fetch vedios from Youtube. 
  24:                     
  28:                         First you need to create developer account in youtube to get developer key. You can get 
  29:                         "http://youtube.com/signup?next=/my_profile_dev" target="_blank">here.
  30:                     
  34:                         Enter Seach text :
  35:                         "txtSearch" runat="server" >
  36:                         "btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
  37:                     
  41:                         
  42:                     
"80%">
  46:                         "dlYoutube" runat="server" CellPadding="4" ForeColor="#333333" OnItemDataBound="dlYoutube_ItemDataBound">
  47:                             
  48:                                 
  49:                                     
  50:                                         
  53:                                     
  54:                                     
  55:                                         
  62:                                         
  90:                                     
  91:                                 
"2">
  51:                                             "lblTotle" Font-Bold="true" runat="server" Text='<%# Eval("title")%>'>
  52:                                         
"top">
  56:                                             <%--"aURL" style="text-decoration: none" runat="server" href='<%# Eval("url")%>'>
  57:                                                 "imgImage" runat="server" ImageUrl='<%# Eval("thumbnail_url")%>' />
  58:                                             --%>
  59:                                             
"server" id="player">
  60:                                             "ltrl" runat="server">
  61:                                         
"top">
  63:                                             
"100%"> 
  64:                                                 
  65:                                                     
  68:                                                     
  71:                                                 
  72:                                                 
  73:                                                     
  76:                                                     
  79:                                                 
  80:                                                 
  81:                                                     
  84:                                                     
  87:                                                 
  88:                                             
  66:                                                         "lblAuthor" runat="server" Text="Author : ">
  67:                                                     
  69:                                                         "lblAuthorName" runat="server" Text='<%# Eval("author")%>'>
  70:                                                     
"top">
  74:                                                         "Label1" runat="server" Text="Description : ">
  75:                                                     
  77:                                                         "Label2" runat="server" Text='<%# Eval("description")%>'>
  78:                                                     
  82:                                                         "Label3" runat="server" Text="Rating : ">
  83:                                                     
  85:                                                         "Label4" runat="server" Text='<%# Eval("rating_avg")%>'>
  86:                                                     
  89:                                         
  92:                             
  93:                             "#5D7B9D" Font-Bold="True" ForeColor="White" />
  94:                             "#E2DED6" Font-Bold="True" ForeColor="#333333" />
  95:                             "White" ForeColor="#284775" />
  96:                             "#F7F6F3" ForeColor="#333333" />
  97:                             "#5D7B9D" Font-Bold="True" ForeColor="White" />
  98:                         
  99:                     
 102:         
 103:     
 104: 
 105: 
Fig – (5) Youtube asp.net aspx page.
   1: using System;
   2: using System.Data;
   3: using System.Configuration;
   4: using System.Collections;
   5: using System.Web;
   6: using System.Web.Security;
   7: using System.Web.UI;
   8: using System.Web.UI.WebControls;
   9: using System.Web.UI.WebControls.WebParts;
  10: using System.Web.UI.HtmlControls;
  11: using System.Text;
  12:  
  13:  
  14: public partial class Youtube_GetYouTubeVedios : System.Web.UI.Page
  15: {
  16:     const string DEVELOPERKEY = "YOUR DEVELOPER KEY";
  17:  
  18:     protected void Page_Load(object sender, EventArgs e)
  19:     {
  20:         
  21:     }
  22:  
  23:     private void GetVedio()
  24:     {      
  25:         
  26:         StringBuilder stbURL = new StringBuilder("http://www.youtube.com/api2_rest?");
  27:         stbURL.Append("method=youtube.videos.list_by_tag");
  28:         stbURL.Append("&dev_id=" + DEVELOPERKEY);
  29:         stbURL.Append("&tag=" + txtSearch.Text.Trim());
  30:         stbURL.Append("&page=-1&per_page=-1"); // you can add custom paging if desired
  31:         
  32:         DataSet ds = new DataSet();
  33:         ds.ReadXml(stbURL.ToString());
  34:  
  35:         dlYoutube.DataSource = ds.Tables[2];
  36:         dlYoutube.DataBind();
  37:         
  38:         
  39:     }
  40:  
  41:     protected void btnSearch_Click(object sender, EventArgs e)
  42:     {
  43:         GetVedio();
  44:     }
  45:     protected void dlYoutube_ItemDataBound(object sender, DataListItemEventArgs e)
  46:     {
  47:         if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
  48:         {
  49:             HtmlControl div = (HtmlControl)e.Item.FindControl("player");
  50:             Literal objL = (Literal)e.Item.FindControl("ltrl");
  51:             objL.Text = "";
  52:         }
  53:     }
  54: }
Fig – (6) Youtube asp.net aspx.cs page.

Happy Programming !!!

May 24, 2010

What's New in the .NET Framework 4

What's New in the .NET Framework 4
This topic contains information about key features and improvements in the .NET Framework version 4. This topic does not provide comprehensive information about all new features and is subject to change.
The .NET Framework 4 introduces an improved security model. For more information, see Security Changes in the .NET Framework 4.
Other new features and improvements in the .NET Framework 4 are described in the following sections:
Application Compatibility and Deployment

The .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, standards compliance, correctness, reliability, and performance.
The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. To run older applications with .NET Framework 4, you must compile your application with the target .NET Framework version specified in the properties for your project in Visual Studio, or you can specify the supported runtime with the Element in an application configuration file.
If your application or component does not work after .NET Framework 4 is installed, please submit a bug on the Microsoft Connect Web site. You can test compatibility as described in the .NET Framework 4 Application Compatibility topic and learn about new features by using the Visual Studio 2010 and .NET Framework 4 Walkthroughs. For additional information and known migration issues, visit the .NET Framework Compatibility blog. 
The following sections describe deployment improvements.

Client Profile

The .NET Framework 4 Client Profile supports more platforms than in previous versions and provides a fast deployment experience for your applications. Several new project templates now target the Client Profile by default. For more information, see .NET Framework Client Profile.

In-Process Side-by-Side Execution

This feature enables an application to load and start multiple versions of the .NET Framework in the same process. For example, you can run applications that load add-ins (or components) that are based on the .NET Framework 2.0 SP1 and add-ins that are based on the .NET Framework 4 in the same process. Older components continue to use the older .NET Framework version, and new components use the new .NET Framework version. For more information, see In-Process Side-by-Side Execution.
Back to top
Core New Features and Improvements

The following sections describe new features and improvements provided by the common language runtime and the base class libraries.

Diagnostics and Performance

Earlier versions of the .NET Framework provided no way to determine whether a particular application domain was affecting other application domains, because the operating system APIs and tools, such as the Windows Task Manager, were precise only to the process level. Starting with the .NET Framework 4, you can get processor usage and memory usage estimates per application domain.
You can monitor CPU and memory usage of individual application domains. Application domain resource monitoring is available through the managed and native hosting APIs and event tracing for Windows (ETW). When this feature has been enabled, it collects statistics on all application domains in the process for the life of the process. See the new AppDomain.MonitoringIsEnabled property.
You can now access the ETW events for diagnostic purposes to improve performance. For more information, see CLR ETW Events and Controlling .NET Framework Logging. Also see Performance Counters and In-Process Side-By-Side Applications.
The System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute attribute enables managed code to handle exceptions that indicate corrupted process state.

Garbage Collection

The .NET Framework 4 provides background garbage collection. This feature replaces concurrent garbage collection in previous versions and provides better performance. For more information, see Fundamentals of Garbage Collection.

Code Contracts

Code contracts let you specify contractual information that is not represented by a method's or type's signature alone. The new System.Diagnostics.Contracts namespace contains classes that provide a language-neutral way to express coding assumptions in the form of preconditions, postconditions, and object invariants. The contracts improve testing with run-time checking, enable static contract verification, and support documentation generation. For more information, see Code Contracts.

Design-Time-Only Interop Assemblies

You no longer have to ship primary interop assemblies (PIAs) to deploy applications that interoperate with COM objects. In the .NET Framework 4, compilers can embed type information from interop assemblies, selecting only the types that an application (for example, an add-in) actually uses. Type safety is ensured by the common language runtime. See Using COM Types in Managed Code and Walkthrough: Embedding Type Information from Microsoft Office Assemblies (C# and Visual Basic).

Dynamic Language Runtime

The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. To support the DLR, the new System.Dynamic namespace is added to the .NET Framework.
The expression trees are extended with new types that represent control flow, for example, System.Linq.Expressions.LoopExpression and System.Linq.Expressions.TryExpression. These new types are used by the dynamic language runtime (DLR) and not used by LINQ.
In addition, several new classes that support the .NET Framework infrastructure are added to the System.Runtime.CompilerServices namespace. For more information, see Dynamic Language Runtime Overview.

Covariance and Contravariance

Several generic interfaces and delegates now support covariance and contravariance. For more information, see Covariance and Contravariance in Generics.

BigInteger and Complex Numbers

The new System.Numerics.BigInteger structure is an arbitrary-precision integer data type that supports all the standard integer operations, including bit manipulation. It can be used from any .NET Framework language. In addition, some of the new .NET Framework languages (such as F# and IronPython) have built-in support for this structure.
The new System.Numerics.Complex structure represents a complex number that supports arithmetic and trigonometric operations with complex numbers.

Tuples

The .NET Framework 4 provides the System.Tuple class for creating tuple objects that contain structured data. It also provides generic tuple classes to support tuples that have from one to eight components (that is, singletons through octuples). To support tuple objects that have nine or more components, there is a generic tuple class with seven type parameters and an eighth parameter of any tuple type. 

File System Enumeration Improvements

New file enumeration methods improve the performance of applications that access large file directories or that iterate through the lines in large files. For more information, see How to: Enumerate Directories and Files.

Memory-Mapped Files

The .NET Framework now supports memory-mapped files. You can use memory-mapped files to edit very large files and to create shared memory for interprocess communication.

64-Bit Operating Systems and Processes

You can identify 64-bit operating systems and processes with the Environment.Is64BitOperatingSystem and Environment.Is64BitProcess properties.
You can specify a 32-bit or 64-bit view of the registry with the Microsoft.Win32.RegistryView enumeration when you open base keys.

Other New Features

The following list describes additional new capabilities, improvements, and conveniences. Several of these are based on customer suggestions.
Back to top
Managed Extensibility Framework

The Managed Extensibility Framework (MEF) is a new library in the .NET Framework 4 that helps you build extensible and composable applications. MEF enables you to specify points where an application can be extended, to expose services to offer to other extensible applications and to create parts for consumption by extensible applications. It also enables easy discoverability of available parts based on metadata, without the need to load the assemblies for the parts. For more information, see Managed Extensibility Framework. For a list of the MEF types, see the System.ComponentModel.Composition namespace.
Parallel Computing

The .NET Framework 4 introduces a new programming model for writing multithreaded and asynchronous code that greatly simplifies the work of application and library developers. The new model enables developers to write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool. The new System.Threading.Tasks namespace and other related types support this new model. Parallel LINQ (PLINQ), which is a parallel implementation of LINQ to Objects, enables similar functionality through declarative syntax. For more information, see Parallel Programming in the .NET Framework.
Networking

Networking improvements include the following:
Web

ASP.NET version 4 introduces new features in the following areas:
  • Core services, including a new API that lets you extend caching, support for compression for session-state data, and a new application preload manager (autostart feature).
  • Web Forms, including more integrated support for ASP.NET routing, enhanced support for Web standards, updated browser support, new features for data controls, and new features for view state management.
  • Web Forms controls, including a new Chart control.
  • MVC, including new helper methods for views, support for partitioned MVC applications, and asynchronous controllers.
  • Dynamic Data, including support for existing Web applications, support for many-to-many relationships and inheritance, new field templates and attributes, and enhanced data filtering.
  • Microsoft Ajax, including additional support for client-based Ajax applications in the Microsoft Ajax Library.
  • Visual Web Developer, including improved IntelliSense for JScript, new auto-complete snippets for HTML and ASP.NET markup, and enhanced CSS compatibility.
  • Deployment, including new tools for automating typical deployment tasks.
  • Multi-targeting, including better filtering for features that are not available in the target version of the .NET Framework.
For more information about these features, see What's New in ASP.NET 4 and Visual Web Developer.
Client

Windows Presentation Foundation

In the .NET Framework 4, Windows Presentation Foundation (WPF) contains changes and improvements in many areas, including controls, graphics, and XAML. For more information, see What's New in WPF Version 4.
Back to top
Data

ADO.NET

ADO.NET provides new features for the Entity Framework, including persistence-ignorant objects, functions in LINQ queries, and customized object layer code generation. For more information, see What's New in ADO.NET.

Dynamic Data

For ASP.NET 4, Dynamic Data has been enhanced to give you even more power for quickly building data-driven Web sites. This includes the following:
  • Automatic validation that is based on constraints that are defined in the data model.
  • The ability to easily change the markup that is generated for fields in the GridView and DetailsView controls by using field templates that are part of a Dynamic Data project.
For more information, see What's New in ASP.NET 4 and Visual Web Developer.

WCF Data Services

ADO.NET Data Service has been renamed to WCF Data Services, and has the following new features
  • Data binding.
  • Counting entities in an entity set.
  • Server-driven paging.
  • Query projections.
  • Custom data service providers.
  • Streaming of binary resources.
For more information, see What's New in WCF Data Services.
Back to top
Windows Communication Foundation

Windows Communication Foundation (WCF) provides the following improvements:
  • Configuration-based Activation: Removes the requirement for having an .svc file.
  • System.Web.Routing Integration: Allows you to have more control over your service's URL (extensionless URLs).
  • Multiple IIS Site Bindings Support: Allows you to have multiple base addresses with the same protocol on the same Web site.
  • Routing Service: Allows you to route messages based on content.
  • Support for WS-Discovery: Allows you to create and search for discoverable services.
  • Standard Endpoints: Predefined endpoints that allow you to specify only certain properties.
  • Workflow Services: Integrates WCF and WF by providing activities to send and receive messages, the ability to correlate messages based on content, and a workflow service host.
  • WCF REST features:
    • Web HTTP Caching: Allows caching of Web HTTP service responses.
    • Web HTTP Formats Support: Allows you to dynamically determine the best format for a service operation to respond in.
    • Web HTTP Services Help Page: Provides an automatic help page for Web HTTP services, similar to the WCF service help page.
    • Web HTTP Error Handling: Allows Web HTTP Services to return error information in the same format as the operation.
    • Web HTTP Cross-Domain JavaScript Support: Allows use of JSONP.
  • Simplified Configuration: Reduces the amount of configuration a service requires
Windows Workflow Foundation

Windows Workflow Foundation provides improvements in the following areas:
  • Improved Workflow Activity Model: The Activity class provides the base abstraction of workflow behavior.
  • Rich Composite Activity Options: Workflows benefit from new flow-control activities that model traditional flow-control structures, such as Flowchart, TryCatch, and Switch.
  • Expanded Built-In Activity Library: New features of the activity library include new flow-control activities, activities for manipulating member data, and activities for controlling transactions.
  • Explicit Activity Data Model: New options for storing or moving data include variable and directional arguments.
  • Enhanced Hosting, Persistence, and Tracking Options: Hosting enhancements include more options for running workflows, explicit persistence using the Persist activity, persisting without unloading, preventing persistence using no-persist zones, using ambient transactions from the host, recording tracking information to the event log, and resuming pending workflows using Bookmark.
  • Easier ability to extend the WF designer: The new WF Designer is built on Windows Presentation Foundation (WPF) and provides an easier model to use when rehosting the WF Designer outside of Visual Studio.