public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new NotificationDbHelper(connection, transaction);

                    if (TemplateId.HasValue)
                    {
                        helper.DeleteNotificationTemplate(TemplateId.Value);
                    }
                    else if (DeleteAll)
                    {
                        var templateId = helper.GetNotificationId(Namespace, Name);
                        if (templateId == null)
                        {
                            throw new Exception($"Reference list '{Namespace}.{Name}' not found");
                        }

                        // delete all if filter is not specified
                        helper.DeleteNotificationTemplates(Namespace, Name);
                    }
                    else
                    {
                        throw new NotSupportedException();
                    }
                }
            };

            processor.Process(exp);
        }
Exemple #2
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new NotificationDbHelper(connection, transaction);
                    helper.DeleteNotificationTemplates(Namespace, Name);
                    helper.DeleteNotification(Namespace, Name);
                }
            };

            processor.Process(exp);
        }