An aggregation of all the Rock Solid Knowledge Blogs
I’ve just realised that DevWeek 2010 is on the horizon. DevWeek is one of my favourite conferences - lots of varied talks, vendor independence and I get to hang out with lots of friends for the week.
This year I’m doing a preconference talk and two sessions:
A Day of .NET 4.0
Mon
15th March 2010
WORKSHOP REF: M1
.NET 4.0 is a major release of .NET, including the first big
changes to the .NET runtime since 2.0. In this series of talks we
will look at the big changes in this release in C#, multithreading,
data access and workflow.
The best-known change in C# is the introduction of dynamic typing.
However, there have been other changes that may affect your lives
as developers more, such as support for generic variance, named and
optional parameters. There is a whole library for multithreading,
PFx, that not only assists you in parallelizing algorithms but in
fact replaces the existing libraries for multithreading with a
unified, powerful single API.
Entity Framework has grown up – the initial release, although
gaining some popularity, missed features that made it truly usable
in large-scale systems. The new release, version 4.0, introduces a
number of features, such as self-tracking objects, that assist
using Entity Framework in n-tier applications.
Finally, workflow gets a total rewrite to allow the engine to be
used far more widely, having overcome limitations in the WF 3.5
API.
This workshop will take you through all of these major changes, and
we’ll also talk about some of the other smaller but important ones
along the way.
An Introduction to Windows
Workflow Foundation 4.0
Tues 16th March 2010
.NET 4.0 introduces a new
version of Windows Workflow Foundation. This new version is a total
rewrite of the version introduced with .NET 3.0. In this talk we
look at what Microsoft are trying to achieve with WF 4.0, why they
felt it necessary to rewrite rather than modify the codebase, and
what new features are available in the new library. Along the way
we will be looking at the new designer, declarative workflows,
asynchronous processing, sequential and flowchart workflows and how
workflow’s automated persistence works.
Creating Workflow-based WCF
Services
Tues 16th March
2010
There are very good
reasons for using a workflow to implement a WCF service: workflows
can provide a clear platform for service composition (using a
number of building block services to generate a functionally richer
service); workflow can manage long running stateful services
without having to write your own plumbing to achieve this. The
latest version of Workflow, 4.0, introduces a declarative model for
authoring workflows and new activities for message based
interaction. In addition we have a framework for flexible message
correlation that allows the contents of a message to determine
which workflow the message is destined for. In this session we will
look at how you can consume services from workflow and expose the
resulting workflow itself as a service.
As well as these you may well see me popping up as a guest code-monkey in the other Rock Solid Knowledge sessions. Hope to see you there
The Routing Service is a new feature of WCF 4.0 (shipping with Visual Studio 2010). It is an out-of-the-box SOAP Intermediary able to perform protocol bridging, multicast, failover and data dependent routing. I’ve just uploaded a new screencast walking through setting up the Routing Service and showing a simple example of protocol bridging (the client sends messages over HTTP and the service receives them over NetTcp). This screencast is one of a series I will be recording about the Routing Service. You can find the screencast here.
Seeing as this has changed completely from WF 3.5 I thought I’d post a quick blog entry to describe how to run a workflow declared in a XAML file.
You may have heard that the WF 4.0 default authoring model is now XAML. However, the Visual Studio 2010 workflow projects store the XAML as a resource in the binary rather than as a text file. So if you want to deploy your workflows as XAML text files how do you run them? In .NET 3.5 you could pass the workflow runtime an XmlReader pointing at the XAML file but in WF 4.0 there is no WorkflowRuntime class. It turns out you need to load the XAML slightly indirectly by creating a special activity called a DynamicActivity
DynamicActivity has an Implementation member that points to a Func<Activity> delegate – in other words you wire up a method that returns an activity (the workflow). Here’s an example:
static void Main(string[] args)
{
DynamicActivity dyn = new DynamicActivity();
//
this line wires up the workflow creator method
dyn.Implementation = CreateWorkflow;
WorkflowInvoker.Invoke(dyn);
}
static Activity
CreateWorkflow()
{
//
we use the new XamlServices utility class to deserialize the XAML
Activity act = (Activity)XamlServices.Load(@"..\..\workflow1.xaml");
return act;
}