private PersistenceProviderDirectory(Activity workflowDefinition, WorkflowServiceHost serviceHost, DurableConsistencyScope consistencyScope, int maxInstances)
 {
     Fx.AssertAndThrow(maxInstances > 0, "MaxInstance must be greater than zero on PPD.");
     this.workflowDefinition = workflowDefinition;
     this.serviceHost = serviceHost;
     this.ConsistencyScope = consistencyScope;
     this.MaxInstances = maxInstances;
     this.throttle = new InstanceThrottle(this.MaxInstances);
     this.pipelinesInUse = new HashSet<PersistencePipeline>();
     this.keyMap = new Dictionary<Guid, PersistenceContext>();
     this.instanceCache = new Dictionary<Guid, PersistenceContext>();
 }
 private PersistenceProviderDirectory(Activity workflowDefinition, WorkflowServiceHost serviceHost, DurableConsistencyScope consistencyScope, int maxInstances)
 {
     Fx.AssertAndThrow(maxInstances > 0, "MaxInstance must be greater than zero on PPD.");
     this.workflowDefinition = workflowDefinition;
     this.serviceHost        = serviceHost;
     this.ConsistencyScope   = consistencyScope;
     this.MaxInstances       = maxInstances;
     this.throttle           = new InstanceThrottle(this.MaxInstances);
     this.pipelinesInUse     = new HashSet <PersistencePipeline>();
     this.keyMap             = new Dictionary <Guid, PersistenceContext>();
     this.instanceCache      = new Dictionary <Guid, PersistenceContext>();
 }
        PersistenceProviderDirectory(WorkflowDefinitionProvider workflowDefinitionProvider, WorkflowServiceHost serviceHost, DurableConsistencyScope consistencyScope, int maxInstances)
        {
            Fx.Assert(workflowDefinitionProvider != null, "definition provider must be specified on PPD.");
            Fx.Assert(serviceHost != null, "WorkflowServiceHost must be specified on PPD.");
            Fx.AssertAndThrow(maxInstances > 0, "MaxInstance must be greater than zero on PPD.");

            this.workflowDefinitionProvider = workflowDefinitionProvider;
            this.serviceHost = serviceHost;

            ConsistencyScope = consistencyScope;
            MaxInstances = maxInstances;

            this.throttle = new InstanceThrottle(MaxInstances, serviceHost);
            this.pipelinesInUse = new HashSet<PersistencePipeline>();

            this.keyMap = new Dictionary<Guid, PersistenceContext>();
            this.instanceCache = new Dictionary<Guid, PersistenceContext>();
            this.loadsInProgress = new Dictionary<InstanceKey, AsyncWaitHandle>();            
        }