/// <summary> /// Internal create trigger routine /// </summary> internal async Task <bool> InternalCreateTriggerAsync(SyncContext ctx, DbTableBuilder tableBuilder, DbTriggerType triggerType, DbConnection connection, DbTransaction transaction, CancellationToken cancellationToken, IProgress <ProgressArgs> progress) { if (tableBuilder.TableDescription.Columns.Count <= 0) { throw new MissingsColumnException(tableBuilder.TableDescription.GetFullName()); } if (tableBuilder.TableDescription.PrimaryKeys.Count <= 0) { throw new MissingPrimaryKeyException(tableBuilder.TableDescription.GetFullName()); } var command = await tableBuilder.GetCreateTriggerCommandAsync(triggerType, connection, transaction).ConfigureAwait(false); if (command == null) { return(false); } var action = new TriggerCreatingArgs(ctx, tableBuilder.TableDescription, triggerType, command, connection, transaction); await this.InterceptAsync(action, cancellationToken).ConfigureAwait(false); if (action.Cancel || action.Command == null) { return(false); } await action.Command.ExecuteNonQueryAsync(); await this.InterceptAsync(new TriggerCreatedArgs(ctx, tableBuilder.TableDescription, triggerType, connection, transaction), cancellationToken).ConfigureAwait(false); return(true); }