Using Session for state for PageFlow?

Topics: User Forum
Jan 31, 2007 at 7:30 PM
I am *not* wanting to use SQL Server for persistance of state (our client is Oracle). We are wanting to use session. In the WCSF help, the topic is very light on how to implement a session state provider for PageFlow. Can anyone helkp out with a config file?

Jan 31, 2007 at 8:25 PM
My guess is;

1. The "pageFlowInstanceStoreProvider" section needn't change - if you just change the connection string it points at in <connectionStrings /> including the provider name the Enterprise Library data access framework should handle Oracle for you.

2. You would need to create your own Windows Workflow persistence service as per this post and replace the "SqlWorkflowPersistenceService" reference under "pageFlow/hostingWorkflowRuntime/services/add" in the web.config file with your own implementation.

I would imagine the rest would work OK.

Anyone else?

Feb 1, 2007 at 1:51 AM
Thanks for the reply. I am not looking to store state in Oracle, but in session.

Feb 1, 2007 at 8:24 AM
Ahhhh... I do apologise - I missed that!

Can you clarify exactly what you want to store in Session? Page Flow instances, data, and workflow instances, plus custom page data? Or just your own data you wish to define? Or just workflow instances?

And why session - why not just "in memory"? The reason I ask is that neither is a durable medium, so if you remove the tracking and persistence services from WF this will 75% achieve your aim by never writing the data out to a database... then you would just need to implement a custom Page Flow Instance Store Provider (look at the definition in Reflector, but I think the interface is called IPageFlowInstanceStore).

My last question is why? Heavy use of in memory storage like this may cause you issues (especially if workflow instances are left lurking around) - in particular if you come to scale out to a server farm it raises interesting questions.

Feb 1, 2007 at 2:32 PM
Rather than answer your question why, I am going to respond back: why cannot we use session with PageFlow.

This is something we could do with UIP, why not with Page Flow?

Has anyone out there been able to get pageflow to store in session like UIP?

Feb 1, 2007 at 4:41 PM
I dont think the default implementation of UIP which saves the data between transitions in a session was a good idea especially when a single wizard page (view) has so many items to be saved in between before it's sumbitted as a single transaction in to the database. One workaround is to save to db upon transition between pages (if and only if your business nature allows). UIP does saves views data in the session which will affect performance and scalability of the overall web site. One thing WCSF does by default (based on WF) is to save data in database, but still i see this as a performance overhead.

I still did not reach to a good solution on how to utlilize WCSF in other ways. anybody has an idea?
Feb 1, 2007 at 4:46 PM
Another good question. I think the distinction is between Session data, and "Workflow Engine" in-memory data...

Windows Workflow by default keeps all data in memory, unless you supply a persistence service. In the WCSF the persistence service used is by default set to be the Sql Persistence Service. If you remove this, it will cause WF to keep all workflows in memory. This is not stored "in session" in the way that you mean (using Page.Session"myvalue" etc). Therefore, even if session is held in a database or state server handling NLB'd servers with page flow instances will be a problem... as the page flow will be on one server or the other, not on both. Having a persistence service helps alleviate this.

I suppose there may be a way you could write a Persistence Service that used Session as it's storage medium, although this sounds tricky (Session may not be available when the Workflow Engine tries to save the Page Flow down etc), so some other storage medium independant of the web request seems a better choice.

There is no reason why you can't use Page.Session, or even better StateValue<T> in WCSF solutions - I apologise if it sounded like I meant that! There is a small distinction between storing data in the Page Flow and in Session using the WCSF though.

I hope that helps a little rather than adding to the confusion, perhaps the p&p guys can make a recommendation?

Has anyone else attempted anything like what Don is asking?

Feb 1, 2007 at 5:53 PM
I'm still confused. Is this the optimum solution one should go with? i.e. saving in databse (using WF persistence service) between page transitions. Shall i take this as a guidence? not sure though.
Feb 21, 2007 at 4:37 AM

In relation to work flow persistence service, is there a configuration settings that allows for data store in XML form rather then binary. Or should I just manage that via SQL session.

Help Much appreciated

Feb 23, 2007 at 3:18 AM
If anyone is interested, I've decided to code a custom provider, for page flow management, this will allow me to defined how state is stored.

Sonny M
Feb 25, 2008 at 11:18 AM
I can tell what can be the reason for such organisation. I have an architectural restriction in project to use only already defined and working Web Services and no local DB allowed.

Storing in memory seems to be not really good idea - Session state in my case is different for each user session so that storing PageFlow Instance in Session state is perfect. Storing in memory causes headache of organising Session-like association of current user and his current PageFlow Instance.

Also session storing approach doesn't prevent scaling solutions. For example in my project scaling is allowed by having more than one Web Application accessing same Application Server built on mentioned Web Services. BTW, amount of data stored per current task if organised effectively won't exceed 1 KB which is nothing for server with 10 GB available.

D1camero, did you solve this problem? Would be really great to have this problem solved..
Feb 29, 2008 at 4:39 AM
Something really helpful on this topic: