Sep 16 2010

Custom Windows Workflow activity for dependency resolution–Part 1

Category: .NetRory Primrose @ 12:41
The previous post talked about the issues with supporting DI in WF4. The nature of Windows Workflow means that there is no true support for DI. Using a custom extension and activity will allow for pulling in dependencies to a workflow while catering for the concerns outlined in the previous post. This series will refer to the dependency injection concept as dependency resolution because this technique is more aligned with the Service Locator pattern than DI. This first part will go through the d... [More]

Tags: ,

Sep 15 2010

Dependency injection options for Windows Workflow 4

Category: .NetRory Primrose @ 11:42
I’m a fan of DI for all the benefits that it brings. Unfortunately dependency injection is not really supported with Windows Workflow. DI is a pattern in which dependencies are calculated outside an entity and provided to the entity for it to use. The DI container is responsible for creating and managing these dependencies and injecting them onto the entity. WF does not fully support this model. Any dependencies calculated outside a workflow must be provided to the workflow execution engine a... [More]

Tags: ,

Sep 10 2010

TFS Build fails for no indicated reason with code contracts in test assemblies

Category: .NetRory Primrose @ 12:02
This has been a curly one for a few months and I’ve finally had some time to resolve the issue. My team has been running TFS Build 2010 with gated check-ins where the build does MSI deploys then runs unit and integration tests. All of a sudden the builds started failing with no indication as to why. The build activity log just stops and does not contain errors. The MS build log file also does not contain any errors. The event log on the build server does shed some light on the situation however... [More]

Tags:

Aug 18 2010

Getting meaningful exceptions from WF

Category: .NetRory Primrose @ 08:33
Overall I love the changes made to WF4. The latest workflow support is a huge leap forward from the 3.x versions. Unfortunately both versions suffer the same issues regarding feedback for the developer when exceptions are thrown. Consider the following simple workflow example. namespace WorkflowConsoleApplication1 { using System; using System.Activities; class Program { static void Main(string[] args) { try { Workflow... [More]

Tags:

Aug 6 2010

Developing multi-threaded workflows

Category: .NetRory Primrose @ 07:21
Most people (myself included) assume that the Parallel and ParallelForEach<T> activities in WF4 run each child in parallel on multiple threads. Unfortunately this is not the case. Each child activity is scheduled in the workflow runtime at the same time. The child activities will only start running in “parallel” if one of the branches is in a waiting state. You can read this post which links to this post for some more detailed information You can achieve multi-threaded parallel execution ... [More]

Tags:

Aug 2 2010

Cleaning a VS2010 solution with a sledgehammer

Category: .Net | My SoftwareRory Primrose @ 07:11
My workplace has been having issues with VS2010 picking up old assemblies since we have been using VS2010 on a complex services solution. The issue usually pops up when executing test runs with the built in support for MSTest. This occasionally happened in VS2008 but is much more prevalent in 2010. The scenario seems to be that somewhere between the IDE and MSTest is picking up assemblies from prior TestResults directories if the assembly can’t be found in bin\Debug or bin\Release director... [More]

Tags:

Jul 27 2010

Tracking lazy loaded build trees in Unity

Category: .NetRory Primrose @ 08:31
I recently posted a Unity extension for disposing build trees created by Resolve and BuildUp actions. Unity has a feature that supports lazy loading injected dependencies that the original disposal extension didn’t cater for. Consider the following example. using System; using Microsoft.Practices.Unity; using Neovolve.Toolkit.Unity; namespace Neovolve.LazyInjectionTesting { class Program { static void Main(String[] args) { IUnityContainer containe... [More]

Tags: ,

Jul 23 2010

Caching workflow activities to increase performance

Category: .NetRory Primrose @ 07:14
David Paquette posted last year about the performance characteristics of WF4. Runtime performance is a typical complaint with WF but it can be minimised as David has indicated. Adding some caching logic for workflow activity instances will avoid the expensive start-up process for invoking activities. Subsequent activity invocations will be much faster by getting the activity instance from the cache rather than creating a new one. I’ve put together an ActivityStore class that handles this cachin... [More]

Tags: ,

Jul 22 2010

Working with custom proxies

Category: .NetRory Primrose @ 07:56
My recent post about creating proxies with RealProxy provided an example for creating a custom proxy implementation. Using proxies can provide a lot of power and flexibility to an application. Most of this code is common plumbing code that can be refactored out into some reusable classes. The ProxyHandler class below is the first of these reusable classes. It helps with creating RealProxy types by providing the common logic of method identification, exception processing and method response mana... [More]

Tags:

Jul 20 2010

Unity Injection With ASP.Net and WCF - Presentation deck and code

Category: .Net | IT RelatedRory Primrose @ 08:25
Yesterday I ran a couple of sessions at the Canberra .Net users group. I have attached a zip of the presentation deck and demo projects for you to have a look at in your own time. Unity Injection With ASP.Net and WCF.zip (1.45 mb)

Tags: , ,