Esempio n. 1
0
        protected void ThrowOnInconsistentCommands(IProductCommand command, IGoodIdentificationCommand innerCommand)
        {
            var properties      = command as ICreateOrMergePatchOrDeleteProduct;
            var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveGoodIdentification;

            if (properties == null || innerProperties == null)
            {
                return;
            }
            if (innerProperties.ProductId == default(string))
            {
                innerProperties.ProductId = properties.ProductId;
            }
            else
            {
                var outerProductIdName  = "ProductId";
                var outerProductIdValue = properties.ProductId;
                var innerProductIdName  = "ProductId";
                var innerProductIdValue = innerProperties.ProductId;
                ThrowOnInconsistentIds(innerProperties, innerProductIdName, innerProductIdValue, outerProductIdName, outerProductIdValue);
            }
        }// END ThrowOnInconsistentCommands /////////////////////
Esempio n. 2
0
        }// END ThrowOnInconsistentCommands /////////////////////

        protected virtual IGoodIdentificationEvent Map(IGoodIdentificationCommand c, IProductCommand outerCommand, long version, IProductState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateGoodIdentification) : null;

            if (create != null)
            {
                return(MapCreate(create, outerCommand, version, outerState));
            }

            var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchGoodIdentification) : null;

            if (merge != null)
            {
                return(MapMergePatch(merge, outerCommand, version, outerState));
            }

            var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveGoodIdentification) : null;

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
Esempio n. 3
0
 void IGoodIdentificationCommands.Remove(IGoodIdentificationCommand c)
 {
     _innerCommands.Remove((CreateOrMergePatchOrRemoveGoodIdentificationDto)c);
 }
Esempio n. 4
0
 public void Remove(IGoodIdentificationCommand c)
 {
     _innerCommands.Remove(c);
 }
Esempio n. 5
0
 public void Add(IGoodIdentificationCommand c)
 {
     _innerCommands.Add(c);
 }