ERROR in creation strategy for Pageflow Provider (not getting injected)

Topics: Web Client Software Factory, Project Management Forum, User Forum
Jul 10, 2007 at 3:15 PM
I have never been able to sucessfully use a page flow in the WCSF june 2007 release. For some reason my pageflow provider is not being injected into my module controller. Please help. I need some re-assurance with this WCSF (right now I am frustrated is seems like .NET is turning into JAVA with huge configuration files and complicated frameworks :( that do simple things, I am sure I'll be alright when I get this to work).

My controller code is basic see below.

public class Module1Controller
{
#region Variable Declaration
IPageFlowProvider _pageflowProvider;
IPageFlow _pageFlow;
#endregion

public Module1Controller()
{
ControllerPageFlow.Start();
}

ProviderDependency(typeof(PageFlowDirectory))
public IPageFlowProvider PageFlowProvider
{
get { return _pageflowProvider; }
set { _pageflowProvider = value; }
}

protected IPageFlow ControllerPageFlow
{
get
{
if (_pageFlow == null)
{
_pageFlow = _pageflowProvider.GetPageFlow(typeof(PageFlowProject1.PageFlow1));
}
return _pageFlow;
}
}


}
In My Solution Web Configuration I have

<sectionGroup name="pageFlow">
<section name="pageFlowProvider" type="Microsoft.Practices.PageFlow.Configuration.PageFlowProviderSection, Microsoft.Practices.PageFlow"/>
<section name="hostingWorkflowRuntime" type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section name="pageFlowInstanceStoreProvider" type="Microsoft.Practices.PageFlow.Configuration.PageFlowInstanceStoreProviderSection, Microsoft.Practices.PageFlow"/>
<section name="pageFlowInstanceCorrelationTokenProvider" type="Microsoft.Practices.PageFlow.Configuration.PageFlowInstanceCorrelationTokenProviderSection, Microsoft.Practices.PageFlow"/>
</sectionGroup>

<connectionStrings>
<add name="PageFlowPersistanceStore" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=WCSF_Quickstart;Data Source=.\SQLExpress" providerName="System.Data.SqlClient"/>
</connectionStrings>

<pageFlow>
<pageFlowProvider providerType="Microsoft.Practices.PageFlow.WorkflowFoundation.WorkflowFoundationPageFlowProvider, Microsoft.Practices.PageFlow.WorkflowFoundation"/>
<hostingWorkflowRuntime Name="Hosting">
<Services>
<add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=WCSF_Quickstart;Data Source=.\SQLEXPRESS;" LoadIntervalSeconds="5" UnloadOnIdle="true"/>
<add type="System.Workflow.Runtime.Hosting.ManualWorkflowSchedulerService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" useActiveTimers="true"/>
<add type="System.Workflow.Activities.ExternalDataExchangeService, System.Workflow.Activities, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</Services>
</hostingWorkflowRuntime>
<pageFlowInstanceStoreProvider providerType="Microsoft.Practices.PageFlow.Storage.EnterpriseLibrary.PageFlowInstanceCorrelationSqlProvider, Microsoft.Practices.PageFlow.Storage.EnterpriseLibrary" connectionString="PageFlowPersistanceStore"/>
<pageFlowInstanceCorrelationTokenProvider providerType="Microsoft.Practices.PageFlow.Storage.EnterpriseLibrary.CookiePageFlowCorrelationTokenProvider, Microsoft.Practices.PageFlow.Storage.EnterpriseLibrary" />
</pageFlow>

<httpModules>
<add name="WebClientAuthorizationModule" type="Microsoft.Practices.CompositeWeb.Authorization.WebClientAuthorizationModule, Microsoft.Practices.CompositeWeb"/>
<add name="ExceptionLoggerHttpModule" type="Microsoft.Practices.CompositeWeb.EnterpriseLibrary.ExceptionLogger, Microsoft.Practices.CompositeWeb.EnterpriseLibrary"/>
<add name="PageFlowModule" type="Microsoft.Practices.PageFlow.PageFlowHttpModule, Microsoft.Practices.PageFlow"/>
</httpModules>

AS Instructed
No Luck I always get
Object reference not set to an instance of an object.

Line 53: if (_pageFlow == null)
Line 54: {
Line 55: ->error is here _pageFlow = _pageflowProvider.GetPageFlow(typeof(PageFlowProject1.PageFlow1));
Line 56: }
Line 57: return _pageFlow;

it is t hrown by the CrationStrategy

Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.method.Invoke(existing, parms);

I am sure it is something simple (that has been poorly documented I must say)

Please Help
Jul 10, 2007 at 4:59 PM
Edited Jul 10, 2007 at 5:00 PM

Solved


Ok it was not documented, but I did look at the Global Bank EFT page flows and here was the problem. The pageflow has to be added to the catalog (PageFlowDirectory.Catalog) in order for it to be injected. In the Global Bank example the EFT Module Initiaizer has a method called RegisterPageFlows() that was not part of part of the Module Initialize Interface (you have to add it yourself). So I did the following in my Module1Initializerclass Added

protected void RegisterPageFlows()
{
PageFlowDirectory.Catalog.Add(
new WorkflowFoundationPageFlowDefinition(Activator.CreateInstance<PageFlowProject1.PageFlow1>()));
}

and called it in

protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)
{
SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("Module1", "~/Module1/Default.aspx", "Module1");
siteMapBuilderService.AddNode(moduleNode);
RegisterPageFlows();
// TODO: register other site map nodes that Module1 module might provide
}

This added the pageflow to the catalog and hence when I call
if (_pageFlow == null)
{
_pageFlow = _pageflowProvider.GetPageFlow(typeof(PageFlowProject1.PageFlow1));
}
In my module controller (see above code), It can actually return something.

If anyone has any questions please don't hesitate to ask me. This one certainly ruined my weekend.
Jul 30, 2007 at 10:31 PM
I have a problem with a very similar problem.

I am getting this error when trying to run my web page with a page flow project.

[ArgumentNullException: Value cannot be null.
Parameter name: type]
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +2771023
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
Microsoft.Practices.PageFlow.PageFlowDirectory.BuildProvider() +297
Microsoft.Practices.PageFlow.PageFlowDirectory.get_Provider() +77
Microsoft.Practices.PageFlow.PageFlowHttpModule.ProcessRequest(HttpRequest request) +92
Microsoft.Practices.PageFlow.PageFlowHttpModule.OnPostAcquireRequestState(Object sender, EventArgs e) +55
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

I found out that is coming from this line in my web.config

<add name="PageFlowModule" type="Microsoft.Practices.PageFlow.PageFlowHttpModule, Microsoft.Practices.PageFlow"/>

I just can't understand why the type is null. I have referenced the Microsoft.Practices.PageFlow.dll.
If you can please help