Exemplo n.º 1
0
        public override bool SaveItem([NotNull] ItemDefinition itemDefinition, [NotNull] ItemChanges changes, [NotNull] CallContext context)
        {
            Assert.ArgumentNotNull(itemDefinition, nameof(itemDefinition));
            Assert.ArgumentNotNull(changes, nameof(changes));
            Assert.ArgumentNotNull(context, nameof(context));

#if DEBUG
            var timer = Stopwatch.StartNew();
#endif

            if (HeadProvider.GetItemDefinition(itemDefinition.ID, context) == null)
            {
                var item = changes.Item;
                Assert.IsNotNull(item, nameof(item));

                if (!MigrateDefaultItem(itemDefinition, item, context))
                {
                    return(false);
                }
            }

            var saved = HeadProvider.SaveItem(itemDefinition, changes, context);

#if DEBUG
            this.Trace(saved, timer, itemDefinition.ID, context);
#endif

            return(saved);
        }