private void InitiateWorkflowRuntime()
        {
            try
            {
                Activity rentalWorkflow = new  MovieRentalProcess();
                _wfApp = new WorkflowApplication(rentalWorkflow,
                                                 //    new WorkflowIdentity
                                                 //{
                                                 //    Name = "v1MovieRentalProcess",
                                                 //    Version = new System.Version(1, 0, 0, 0)
                                                 //});
                                                 new WorkflowIdentity
                {
                    Name    = "v2MovieRentalProcess",
                    Version = new System.Version(2, 0, 0, 0)
                });

                _wfApp.SynchronizationContext = SynchronizationContext.Current;
                _wfApp.OnUnhandledException   = OnUnhandledException;
                _wfApp.Completed     = OnWorkflowCompleted;
                _wfApp.Idle          = OnWorkflowIdle;
                _wfApp.InstanceStore = _instanceStore;
                _wfApp.Unloaded      = OnWorkflowUnloaded;

                //_wfApp.PersistableIdle = delegate(WorkflowApplicationIdleEventArgs e)
                //{
                //    // Instruct the runtime to persist and unload the workflow
                //    return PersistableIdleAction.Persist;
                //};
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void InitiateWorkflowRuntime()
        {
            try
            {
                Activity rentalWorkflow = new  MovieRentalProcess();
                _wfApp = new WorkflowApplication(rentalWorkflow,
                //    new WorkflowIdentity
                //{
                //    Name = "v1MovieRentalProcess",
                //    Version = new System.Version(1, 0, 0, 0)
                //});
                new WorkflowIdentity
                {
                    Name = "v2MovieRentalProcess",
                    Version = new System.Version(2, 0, 0, 0)
                });

                _wfApp.SynchronizationContext = SynchronizationContext.Current;
                _wfApp.OnUnhandledException = OnUnhandledException;
                _wfApp.Completed = OnWorkflowCompleted;
                _wfApp.Idle = OnWorkflowIdle;
                _wfApp.InstanceStore = _instanceStore;
                _wfApp.Unloaded = OnWorkflowUnloaded;

                //_wfApp.PersistableIdle = delegate(WorkflowApplicationIdleEventArgs e)
                //{
                //    // Instruct the runtime to persist and unload the workflow 
                //    return PersistableIdleAction.Persist;
                //};

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }