Is Sequential workflow can be a base workflow and can we access methods inside that by inheritin

Hi,

I am trying to acheive Pure XAML in ASP.Net. The steps in my work

1. I had one Sequential WorkflowLibrary which is having code as shown below.I have removedsealedtomake that inheritable.

publicint testCondition = 0;

publicvoid If_Exec(object sender,EventArgs e){

MessageBox.Show("If Executed");}

publicvoid Else_Exec(object sender,EventArgs e){

MessageBox.Show("Else Executed");}

2. I took one more workflowlibrary with sequential workflow with code separation(Workflow1.xoml) file. I have removed workflow1.xoml.cs file and Set the base class as Previous worklflow by adding reference.

3. Now I Placed IfElse Activity in Workflow1.xoml file. I placed 2 Code Activities in If Else branches respectively. I set the Condition as this.testCondition==0, this is working fine. But when I am trying to Add ExecuteCode property for Code Activities as "Activity=BaseCode, Path=If_exec" it is giving error like "Cannot resolve BaseCode".

Same thing I am able to do when I am using StateMachine Workflow as Base Workflow. Can't we put BaseCode in Sequential workflow? and pure XAML thing(changing rules and Activities without compilation) can be done through sequential workflow?.

Can anybody please help me for making this success. Thanks in advance.

[3106 byte] By [Satyavani] at [2007-12-21]
# 1

You should look at my XAML activation and how to use it and Using XAML activation in ASP.NET with a StateMachineWorkflow blog post.If you are planning on hosting the workflow in ASP.NET you probably shouldn’t be using MessageBox.Show since the code will be run on the server and not the client.

TomLake at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

Hi tom,

Thanks for ur reply. I will remove MessageBox from my code and replace it with HttpContext.Current.Response.Write, I think it works fine on the server.

I have executed ur sample successfully. I want to do the same with Sequential workflow instead of State Machine and I want to do that workflow library as a webservice instead of copying .xoml file in to WebApplication.

a). Is it possible to do that(.xoml) in sequential workflow, bcoz I want to make it as a webservice.

b).(Or) Can we publish State Machine wrokflow as a wenservice.

Please help me in above things. thanks in advance.

Satyavani at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

Satya vani wrote:

a). Is it possible to do that(.xoml) in sequential workflow, bcoz I want to make it as a webservice.

b).(Or) Can we publish State Machine wrokflow as a wenservice.

In order to publish a workflow as a webservice you have to compile the workflow.A workflow that is used with XAML activation can not be compiled because it is missing the x:Class.

TomLake at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4

Ok tom,

I understood - without x:class we can't publish workflow library as webservice. The reason why I want to publish my workflow as a webservice is

I am using XAML Activation from ASP.Net I am copying workflow1.xoml , workflow1.rules files to my Webapplication. Then I am starting Workflow(which is copied from Workflow library to the same root folder) from my .aspx page as shown below.

System.Xml.XmlReader reader = System.Xml.XmlReader.Create(Page.MapPath("Workflow1.xoml"));

System.Xml.XmlReader reader1 = System.Xml.XmlReader.Create(Page.MapPath("Workflow1.rules"));

WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(reader, reader1, new Dictionary<string,object>());

Then I have created Virtual directory for my webapplication and I am able to run the application. Now I want to achieve the dynamic changes of rules file without compilation. I have changed a condition in rules file and tried to save that file, but it is not accepting me to save that file. For this rule condition change to be affected in my application I have restarted IIS. Then the changes are affected.

.rules file is holding by the Server, bcoz we are placing it in web application. So Instead of Restarting IIS how can I change and save .rules/xoml file. Please give me suggession.

Satyavani at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5

You might want to try and close your XmlTextReaders after the you start the workflow. Those probably have the lock on your file which is why you can't change it.

Matt

MattMilner-Pluralsight at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 6

Hi Tom,

This reply is after long period. Now I am doing XAML activation in VB code. Earlier for getting Base workflow to be as a referenced Assembly for setting the base class, sealed keyword needs to be removed in c# as shown below

public partial sealed class BaseOrderWorkflow : StateMachineWorkflowActivity

But in VB the code is like the following

Public Class ATBaseWorkflow

Inherits StateMachineWorkflowActivity

I built the workflow(VB) and added reference to another workflow and tried to set the Base Class property of the StateMachine workflow where my(.xoml) file existed. But I didn't find the above workflow in referenced assemblies and not able to add that workflow's class as base class.

Can u please help me, how can I get the above workflow class as a base class, Is there any keyword(MustInherit or ....) required to add for the above class?.

Please help me in doing the above.

Thank You

Satya

Satyavani at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified