internal static bool TryGetValue <T>(IDictionary <XName, InstanceValue> data, XName key, out T value)
        {
            InstanceValue value2;

            value = default(T);
            if (!data.TryGetValue(key, out value2) || value2.IsDeletedValue)
            {
                return(false);
            }
            if (value2.Value is T)
            {
                value = (T)value2.Value;
                return(true);
            }
            if ((value2.Value == null) && !(((T)value) is ValueType))
            {
                return(true);
            }
            if (value2.Value == null)
            {
                throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new InstancePersistenceException(SRCore.NullAssignedToValueType(typeof(T))));
            }
            throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new InstancePersistenceException(SRCore.IncorrectValueType(typeof(T), value2.Value.GetType())));
        }
            private void EnsureWorkflowHostType()
            {
                InstanceValue value2;

                if (!this.view.InstanceMetadata.TryGetValue(WorkflowNamespace.WorkflowHostType, out value2))
                {
                    throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new InstancePersistenceCommandException(SRCore.NullAssignedToValueType(this.ppd.serviceHost.DurableInstancingOptions.ScopeName)));
                }
                if (!this.ppd.serviceHost.DurableInstancingOptions.ScopeName.Equals(value2.Value))
                {
                    throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new InstancePersistenceCommandException(SRCore.IncorrectValueType(this.ppd.serviceHost.DurableInstancingOptions.ScopeName, value2.Value)));
                }
            }