Exemplo n.º 1
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new ReferenceListDbHelper(connection, transaction);

                    var refListId = helper.GetReferenceListId(Namespace, Name);
                    if (refListId == null)
                    {
                        throw new Exception($"Reference list '{Namespace}.{Name}' not found");
                    }

                    if (DeleteAll)
                    {
                        // delete all if filter is not specified
                        helper.DeleteReferenceListItems(Namespace, Name);
                    }
                    else
                    if (ItemValue.HasValue)
                    {
                        helper.DeleteReferenceListItem(Namespace, Name, ItemValue.Value);
                    }
                }
            };

            processor.Process(exp);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new ReferenceListDbHelper(connection, transaction);
                    helper.DeleteReferenceListItems(Namespace, Name);
                    helper.DeleteReferenceList(Namespace, Name);
                }
            };

            processor.Process(exp);
        }