Click here to Skip to main content
15,895,836 members
Articles / Web Development / ASP.NET

Navigational Workflows Unleashed in WWF/ASP.NET 3.5

Rate me:
Please Sign up or sign in to vote.
4.97/5 (42 votes)
21 Oct 2008CPOL18 min read 226K   1.6K   165  
Case-study on the internals of a Navigational Workflow engine for a fictional dating website called “World Wide Dating”.
��-- Copyright (c) Microsoft Corporation.  All rights reserved.



SET NOCOUNT ON



--

-- ROLE state_persistence_users

--

declare @localized_string_AddRole_Failed nvarchar(256)

set @localized_string_AddRole_Failed = N'Failed adding the ''state_persistence_users'' role'



DECLARE @ret int, @Error int

IF NOT EXISTS( SELECT 1 FROM [dbo].[sysusers] WHERE name=N'state_persistence_users' and issqlrole=1 )

 BEGIN



	EXEC @ret = sp_addrole N'state_persistence_users'



	SELECT @Error = @@ERROR



	IF @ret <> 0 or @Error <> 0

		RAISERROR( @localized_string_AddRole_Failed, 16, -1 )

 END

GO





--

-- TABLE InstanceState

--

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[InstanceState]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table [dbo].[InstanceState]

GO

CREATE TABLE [dbo].[InstanceState] (

	[uidInstanceID] [uniqueidentifier] NOT NULL ,

	[state] [image] NULL ,

	[status] [int] NULL ,

	[unlocked] [int] NULL ,

	[blocked] [int] NULL ,

	[info] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

	[modified] [datetime] NOT NULL,

	[ownerID] [uniqueidentifier] NULL ,

	[ownedUntil] [datetime] NULL,

	[nextTimer] [datetime] NULL

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

CREATE  UNIQUE CLUSTERED  INDEX [IX_InstanceState] ON [dbo].[InstanceState]([uidInstanceID]) ON [PRIMARY]

-- CREATE  NONCLUSTERED  INDEX [IX_InstanceState_Ownership] ON [dbo].[InstanceState]([ownerID],[ownedUntil])

GO





--

-- TABLE CompletedScope

--

IF EXISTS (SELECT * FROM [dbo].[sysobjects] WHERE id = object_id(N'[dbo].[CompletedScope]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)

DROP TABLE [dbo].[CompletedScope]

GO

CREATE TABLE [dbo].[CompletedScope] (

	[uidInstanceID] [uniqueidentifier] NOT NULL,

	[completedScopeID] [uniqueidentifier] NOT NULL,

	[state] [image] NOT NULL,

	[modified] [datetime] NOT NULL

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

CREATE  NONCLUSTERED  INDEX [IX_CompletedScope] ON [dbo].[CompletedScope]([completedScopeID]) ON [PRIMARY]

GO

CREATE  NONCLUSTERED  INDEX [IX_CompletedScope_InstanceID] ON [dbo].[CompletedScope]( [uidInstanceID] )

GO





DBCC TRACEON (1204)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Turing Inc.
United States United States

Comments and Discussions