public void Clear()
        {
            DomainObjectCheckUtility.EnsureNotDeleted(GetAssociatedEndPoint().GetDomainObjectReference(), GetAssociatedEndPoint().ClientTransaction);

            var combinedCommand = GetClearCommand();

            combinedCommand.NotifyAndPerform();
        }
Esempio n. 2
0
        public void EnsureNotDeleted_Deleted()
        {
            var relatedObject = DomainObjectIDs.OrderItem1.GetObject <OrderItem>();

            relatedObject.Delete();

            DomainObjectCheckUtility.EnsureNotDeleted(relatedObject, TestableClientTransaction);
        }
        public void Replace(int index, DomainObject value)
        {
            ArgumentUtility.CheckNotNull("value", value);

            CheckClientTransaction(value, "Cannot put DomainObject '{0}' into the collection of property '{1}' of DomainObject '{2}'.");
            DomainObjectCheckUtility.EnsureNotDeleted(value, GetAssociatedEndPoint().ClientTransaction);
            DomainObjectCheckUtility.EnsureNotDeleted(GetAssociatedEndPoint().GetDomainObjectReference(), GetAssociatedEndPoint().ClientTransaction);

            var replaceCommand            = GetAssociatedEndPoint().CreateReplaceCommand(index, value);
            var bidirectionalModification = replaceCommand.ExpandToAllRelatedObjects();

            bidirectionalModification.NotifyAndPerform();

            GetAssociatedEndPoint().Touch();
        }
        public void Insert(int index, DomainObject domainObject)
        {
            ArgumentUtility.CheckNotNull("domainObject", domainObject);

            CheckClientTransaction(domainObject, "Cannot insert DomainObject '{0}' into collection of property '{1}' of DomainObject '{2}'.");
            DomainObjectCheckUtility.EnsureNotDeleted(domainObject, GetAssociatedEndPoint().ClientTransaction);
            DomainObjectCheckUtility.EnsureNotDeleted(GetAssociatedEndPoint().GetDomainObjectReference(), GetAssociatedEndPoint().ClientTransaction);

            var insertCommand             = GetAssociatedEndPoint().CreateInsertCommand(domainObject, index);
            var bidirectionalModification = insertCommand.ExpandToAllRelatedObjects();

            bidirectionalModification.NotifyAndPerform();

            GetAssociatedEndPoint().Touch();
        }
        public bool Remove(DomainObject domainObject)
        {
            ArgumentUtility.CheckNotNull("domainObject", domainObject);

            CheckClientTransaction(domainObject, "Cannot remove DomainObject '{0}' from collection of property '{1}' of DomainObject '{2}'.");
            DomainObjectCheckUtility.EnsureNotDeleted(domainObject, GetAssociatedEndPoint().ClientTransaction);
            DomainObjectCheckUtility.EnsureNotDeleted(GetAssociatedEndPoint().GetDomainObjectReference(), GetAssociatedEndPoint().ClientTransaction);

            var containsObjectID = ContainsObjectID(domainObject.ID);

            if (containsObjectID)
            {
                CreateAndExecuteRemoveCommand(domainObject);
            }

            GetAssociatedEndPoint().Touch();
            return(containsObjectID);
        }
        public bool Remove(ObjectID objectID)
        {
            ArgumentUtility.CheckNotNull("objectID", objectID);

            DomainObjectCheckUtility.EnsureNotDeleted(GetAssociatedEndPoint().GetDomainObjectReference(), GetAssociatedEndPoint().ClientTransaction);

            var domainObject = GetObject(objectID);

            if (domainObject != null)
            {
                // we can rely on the fact that this object is not deleted, otherwise we wouldn't have got it
                Assertion.IsTrue(domainObject.TransactionContext[GetAssociatedEndPoint().ClientTransaction].State != StateType.Deleted);

                CreateAndExecuteRemoveCommand(domainObject);
            }

            GetAssociatedEndPoint().Touch();
            return(domainObject != null);
        }