public ObjectEndPointSetSameCommand(IObjectEndPoint modifiedEndPoint, IClientTransactionEventSink transactionEventSink)
     : base(
         ArgumentUtility.CheckNotNull("modifiedEndPoint", modifiedEndPoint),
         modifiedEndPoint.GetOppositeObject(),
         modifiedEndPoint.GetOppositeObject(),
         transactionEventSink)
 {
 }
Example #2
0
 private void CheckNewRelatedObjectType(IObjectEndPoint objectEndPoint, DomainObject newRelatedObject)
 {
     if (!objectEndPoint.Definition.GetOppositeEndPointDefinition().ClassDefinition.IsSameOrBaseClassOf(newRelatedObject.ID.ClassDefinition))
     {
         var message = string.Format(
             "DomainObject '{0}' cannot be assigned to property '{1}' of DomainObject '{2}', because it is not compatible with the type of the property.",
             newRelatedObject.ID,
             objectEndPoint.Definition.PropertyName,
             objectEndPoint.ObjectID);
         throw new ArgumentException(
                   message,
                   "newRelatedObject");
     }
 }
        public ObjectEndPointDeleteCommand(
            IObjectEndPoint modifiedEndPoint, Action oppositeObjectNullSetter, IClientTransactionEventSink transactionEventSink)
            : base(
                ArgumentUtility.CheckNotNull("modifiedEndPoint", modifiedEndPoint),
                null,
                null,
                ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink))
        {
            ArgumentUtility.CheckNotNull("oppositeObjectNullSetter", oppositeObjectNullSetter);

            _oppositeObjectNullSetter = oppositeObjectNullSetter;
            if (modifiedEndPoint.IsNull)
            {
                throw new ArgumentException("Modified end point is null, a NullEndPointModificationCommand is needed.", "modifiedEndPoint");
            }
        }
Example #4
0
        protected ObjectEndPointSetCommand(
            IObjectEndPoint modifiedEndPoint,
            DomainObject newRelatedObject,
            Action <DomainObject> oppositeObjectSetter,
            IClientTransactionEventSink transactionEventSink
            )
            : base(ArgumentUtility.CheckNotNull("modifiedEndPoint", modifiedEndPoint),
                   modifiedEndPoint.GetOppositeObject(),
                   newRelatedObject,
                   ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink))
        {
            ArgumentUtility.CheckNotNull("oppositeObjectSetter", oppositeObjectSetter);

            if (modifiedEndPoint.IsNull)
            {
                throw new ArgumentException("Modified end point is null, a NullEndPointModificationCommand is needed.", "modifiedEndPoint");
            }

            _oppositeObjectSetter = oppositeObjectSetter;
        }
        public ObjectEndPointSetUnidirectionalCommand(
            IObjectEndPoint modifiedEndPoint,
            DomainObject newRelatedObject,
            Action <DomainObject> oppositeObjectSetter,
            IClientTransactionEventSink transactionEventSink)
            : base(modifiedEndPoint, newRelatedObject, oppositeObjectSetter, transactionEventSink)
        {
            if (!modifiedEndPoint.Definition.GetOppositeEndPointDefinition().IsAnonymous)
            {
                var message = string.Format("EndPoint '{0}' is from a bidirectional relation - use a ObjectEndPointSetOneOneCommand or ObjectEndPointSetOneManyCommand instead.",
                                            modifiedEndPoint.Definition.PropertyName);
                throw new ArgumentException(message, "modifiedEndPoint");
            }

            if (newRelatedObject == modifiedEndPoint.GetOppositeObject())
            {
                var message = string.Format("New related object for EndPoint '{0}' is the same as its old value - use a ObjectEndPointSetSameCommand instead.",
                                            modifiedEndPoint.Definition.PropertyName);
                throw new ArgumentException(message, "newRelatedObject");
            }
        }
        protected override void SetOppositeObjectDataFromSubTransaction(IObjectEndPoint sourceObjectEndPoint)
        {
            var sourceAsRealObjectEndPoint = ArgumentUtility.CheckNotNullAndType <RealObjectEndPoint> ("sourceObjectEndPoint", sourceObjectEndPoint);

            ForeignKeyDataContainer.SetValueDataFromSubTransaction(PropertyDefinition, sourceAsRealObjectEndPoint.ForeignKeyDataContainer);
        }
 protected abstract void SetOppositeObjectDataFromSubTransaction(IObjectEndPoint sourceObjectEndPoint);
Example #8
0
 protected override void SetOppositeObjectDataFromSubTransaction(IObjectEndPoint sourceObjectEndPoint)
 {
     throw new NotImplementedException();
 }
Example #9
0
 public void CallSetOppositeObjectDataFromSubTransaction(IObjectEndPoint sourceObjectEndPoint)
 {
     SetOppositeObjectDataFromSubTransaction(sourceObjectEndPoint);
 }
        protected override void SetOppositeObjectDataFromSubTransaction(IObjectEndPoint sourceObjectEndPoint)
        {
            var sourceVirtualObjectEndPoint = ArgumentUtility.CheckNotNullAndType <VirtualObjectEndPoint> ("sourceObjectEndPoint", sourceObjectEndPoint);

            _loadState.SetDataFromSubTransaction(this, sourceVirtualObjectEndPoint._loadState);
        }