Month: November 2009

Post navigation

Note: This blog post is written using the .NET framework 4.0 Beta 2 In Windows Workflow Foundation 4 there are a number of “activities” in the designer that aren’t really activities but activity templates. The most obvious of there are the ReceiveAndSendReply and the SendAndReceiveReply in the Messaging section of the toolbox. If you search for either of these activities you are not going to find them. Their real name is ReceiveAndSendReplyFactory and SendAndReceiveReplyFactory respectively and they aren’t activities but activity templates. So how to create an activity template? Quite simply create a class and implement the IActivityTemplateFactory interface. … Continue reading Creating complex activities in the workflow designer

Tomorrow I will be doing an online presentation about Windows Workflow Foundation 4. The meeting lasts 1 hour and starts at 4PM European time, 3PM UTC or 7AM PST. The goal is to provide an overview of WF4 and how to get started with it in Visual Studio 2010. I will be doing the meeting using LiveMeeting and you can register here. During the meeting I will also be tracking the Twitter hash tag #dmwf4 for additional questions and feedback. “See” you there tomorrow [:)] [f1] [f2]

Note: This blog post is written using the .NET framework 4.0 Beta 2 I can’t say I am a fan of the way the TryCatch activity is implemented in Windows Workflow Foundation 4. For starters there is a Finally block where you can add some activities you want to execute. Sounds nice and very much like the try/catch/finally code construct we have in C# or Visual Basic. Except that it behaves in a subtlety different way. With the C# try/catch/finally the finally code will always run, whether you catch the exception or not. In fact you can just use a … Continue reading TryCatch activity in WF4

If you are looking for the demo files from my CodeCamp presentation in the Netherlands you can download the notes here and the complete sample code here. No PowerPoint, after all this was a CodeCamp [:)] And when my ISP is fully operational again [:(] the demo can be viewed online here. Enjoy, I enjoyed organizing the CodeCamp and doing this presentation. [f1] [f2]

Note: This blog post is written using the .NET framework 4.0 Beta 2 The whole persistence model has changed quite a but for WF4. The persistence class out of the box is called SqlWorkflowInstanceStore and as the name suggests it saves workflow data in either SQL Server 2005 or 2008. It is based on the InstanceStore class to if you prefer some other store all you need to do is subclass the InstanceStore and create your own. So what can we do with the SqlWorkflowInstanceStore? We can attach it to either a WorkflowApplication or a WorkflowServiceHost and persist … Continue reading Windows Workflow Foundation 4 and persistence

This one bit me today a bit unexpectedly. I was comparing two Uri’s and was getting unexpected matches between two Uri’s that where quite clearly not the same. Turns out the when comparing Uri’s the Fragment, or anchor or part after the #, is not part of the comparison. So the following unit test passes even though I would have expected it to fail! [TestMethod] public void TestTwoEqualUrisWithDifferentAnchorShouldNotBeEqual() { var baseUri = new Uri("http://www.test.com"); var uri1 = new Uri(baseUri, "#anchor1"); var uri2 = new Uri(baseUri, "#anchor2"); Assert.AreEqual(uri1, uri2); Assert.AreNotEqual(uri1.ToString(), uri2.ToString()); } Note that when comparing uri1 and uri2 … Continue reading Comparing two Uri’s

recently I had to send a bunch of identical email messages for the CodeCamp we are organizing. Now there are plenty of ways to do this but I decided to write a little program using C# to send them. And just to make sure I can find the code next year [:)] var from = new MailAddress("<<your email>>", "<<your name??"); var to = new MailAddress("<<destination address>>", "<<their name>>"); var message = new MailMessage(from, to); message.Subject = "The subject"; message.Body = "The message body"; message.IsBodyHtml = true; var host = "smtp.gmail.com"; var client = new SmtpClient(host, 587); client.EnableSsl = … Continue reading Sending mail messages through Gmail