/// <summary>
 ///     Creates an emerged activity instance
 /// </summary>
 public MigratingActivityInstance(ScopeImpl targetScope, ExecutionEntity scopeExecution)
 {
     this.targetScope        = targetScope;
     currentScope            = targetScope;
     RepresentativeExecution = scopeExecution;
     InstanceBehavior        = DetermineBehavior(targetScope);
 }
        /// <summary>
        ///     Creates a migrating activity instances
        /// </summary>
        public MigratingActivityInstance(IActivityInstance activityInstance, IMigrationInstruction migrationInstruction,
                                         ScopeImpl sourceScope, ScopeImpl targetScope, ExecutionEntity scopeExecution)
        {
            this.activityInstance     = activityInstance;
            this.migrationInstruction = migrationInstruction;
            this.sourceScope          = sourceScope;
            currentScope            = sourceScope;
            this.targetScope        = targetScope;
            RepresentativeExecution = scopeExecution;
            InstanceBehavior        = DetermineBehavior(sourceScope);

            if ((activityInstance.ChildActivityInstances.Length == 0) &&
                (activityInstance.ChildTransitionInstances.Length == 0))
            {
                ActiveState = RepresentativeExecution.IsActive;
            }
        }