When using the web.config to configure the pageflow provider, there is no way to customize the INavigationService used within the WorkflowFoundationPageFlowProvider. It is hardcoded on line 55 as:
public WorkflowFoundationPageFlowProvider(PageFlowInstanceStoreProviderSection pageFlowInstanceStoreProviderSection, PageFlowInstanceCorrelationTokenProviderSection pageFlowCorrelationTokenProviderSection)
{
...
_pageFlowFactory = new WorkflowFoundationPageFlowFactory();
...
}
This constructor uses Microsoft.Practices.PageFlow.Services.NavigationService:
public WorkflowFoundationPageFlowFactory() : this(new NavigationService())
{
}
I propose:
1) Adding a navigationType configuration element to PageFlowProviderSection, which defaults to Microsoft.Practices.PageFlow.Services.NavigationService but allows a custom value to be entered if necessary:
/// <summary>
/// Defines the concrete type of the INavigator.
/// </summary>
[ConfigurationProperty("navigationType", DefaultValue = "Microsoft.Practices.PageFlow.Services.NavigationService", IsRequired = false)]
public string NavigationType
{
get { return (string)base["navigationType"]; }
}
2) Constructor for WorkFlowFoundationPageFlowProvider would be modified as:
public WorkflowFoundationPageFlowProvider(PageFlowInstanceStoreProviderSection pageFlowInstanceStoreProviderSection, PageFlowInstanceCorrelationTokenProviderSection pageFlowCorrelationTokenProviderSection)
{
...
_pageFlowFactory = new WorkflowFoundationPageFlowFactory(navigationService);
...
}
and (3): Modify BuildProvider to use specified navigationType and pass it on to the WorkflowFoundationPageFlowProvider constructor:
private static IPageFlowProvider BuildProvider()
{
...
Type navigationType = Type.GetType(configSection.NavigationType);
Services.INavigationService navigationService = (Services.INavigationService)Activator.CreateInstance(navigationType);
_provider = (IPageFlowProvider) Activator.CreateInstance(providerType,
BindingFlags.CreateInstance,
null,
new object[] { navigationService, storeSection, tokenProviderSection },
CultureInfo.CurrentCulture);
...
}
Enjoy!