protected internal override void Validate(InstanceView view)
 {
     if (view.IsBoundToInstanceOwner)
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(SR.AlreadyBoundToOwner));
     }
     InstancePersistence.ValidatePropertyBag(this.instanceOwnerMetadata);
 }
Exemple #2
0
        protected internal override void Validate(InstanceView view)
        {
            if (!view.IsBoundToInstanceOwner)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.OwnerRequired));
            }
            if (view.IsBoundToInstance)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.AlreadyBoundToInstance));
            }

            if (LookupInstanceKey == Guid.Empty)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.LoadOpKeyMustBeValid));
            }

            if (AssociateInstanceKeyToInstanceId == Guid.Empty)
            {
                if (InstanceKeysToAssociate.ContainsKey(LookupInstanceKey))
                {
                    throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.LoadOpAssociateKeysCannotContainLookupKey));
                }
            }
            else
            {
                if (!AcceptUninitializedInstance)
                {
                    throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.LoadOpFreeKeyRequiresAcceptUninitialized));
                }
            }

            if (_keysToAssociate != null)
            {
                foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > key in _keysToAssociate)
                {
                    InstancePersistence.ValidatePropertyBag(key.Value);
                }
            }
        }
        protected internal override void Validate(InstanceView view)
        {
            if (!view.IsBoundToInstance)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SRCore.InstanceRequired));
            }

            if (!view.IsBoundToInstanceOwner)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
            }

            if (_keysToAssociate != null)
            {
                foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > key in _keysToAssociate)
                {
                    InstancePersistence.ValidatePropertyBag(key.Value);
                }
            }

            if (_keyMetadataChanges != null)
            {
                foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > key in _keyMetadataChanges)
                {
                    InstancePersistence.ValidatePropertyBag(key.Value, true);
                }
            }

            if (this.CompleteInstance && !this.UnlockInstance)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SRCore.ValidateUnlockInstance));
            }

            InstancePersistence.ValidatePropertyBag(_instanceMetadataChanges, true);
            InstancePersistence.ValidatePropertyBag(_instanceData);
        }
Exemple #4
0
        protected internal override void Validate(InstanceView view)
        {
            if (!view.IsBoundToInstance)
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.InstanceRequired));
            }

            if (!view.IsBoundToInstanceOwner)
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.OwnerRequired));
            }

            if (this.keysToAssociate != null)
            {
                foreach (var key in this.keysToAssociate)
                {
                    InstancePersistence.ValidatePropertyBag(key.Value);
                }
            }

            if (this.keyMetadataChanges != null)
            {
                foreach (var key in this.keyMetadataChanges)
                {
                    InstancePersistence.ValidatePropertyBag(key.Value, true);
                }
            }

            if (this.CompleteInstance && !this.UnlockInstance)
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.ValidateUnlockInstance));
            }

            InstancePersistence.ValidatePropertyBag(this.instanceMetadataChanges, true);
            InstancePersistence.ValidatePropertyBag(this.instanceData);
        }