/// <summary>
        /// Creates a command which will delete a range of entities, validating that the conditions has at least one property
        /// </summary>
        public static CommandDefinition MakeDeleteRangeCommand <TEntity>(
            object conditions,
            IDbTransaction transaction,
            IDialect dialect,
            int?commandTimeout,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.NotNull(conditions, nameof(conditions));
            var config = MicroCRUDConfig.Current;

            dialect = dialect ?? config.Dialect;

            var entityType       = typeof(TEntity);
            var tableSchema      = TableSchemaFactory.GetTableSchema(entityType, dialect, config.SchemaFactory);
            var conditionsSchema = TableSchemaFactory.GetConditionsSchema(entityType, tableSchema, conditions.GetType(), dialect, config.SchemaFactory);

            if (conditionsSchema.IsEmpty)
            {
                throw new ArgumentException(
                          "DeleteRange<TEntity> requires at least one condition, use DeleteAll<TEntity> to delete everything.");
            }

            var sql = dialect.MakeDeleteRangeStatement(tableSchema, dialect.MakeWhereClause(conditionsSchema, conditions));

            return(MakeCommandDefinition(sql, conditions, transaction, commandTimeout, cancellationToken));
        }
        /// <summary>
        /// Creates a command which will delete all entities
        /// </summary>
        public static CommandDefinition MakeDeleteAllCommand <TEntity>(
            IDbTransaction transaction,
            IDialect dialect,
            int?commandTimeout,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var config = MicroCRUDConfig.Current;

            dialect = dialect ?? config.Dialect;
            var tableSchema = TableSchemaFactory.GetTableSchema(typeof(TEntity), dialect, config.SchemaFactory);
            var sql         = dialect.MakeDeleteRangeStatement(tableSchema, null);

            return(MakeCommandDefinition(sql, null, transaction, commandTimeout, cancellationToken));
        }
        /// <summary>
        /// Creates a command which will delete a range of entities, validating that the conditions contains a WHERE clause.
        /// </summary>
        public static CommandDefinition MakeDeleteRangeCommand <TEntity>(
            string conditions,
            object parameters,
            IDbTransaction transaction,
            IDialect dialect,
            int?commandTimeout,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            if (conditions == null || conditions.IndexOf("WHERE ", StringComparison.OrdinalIgnoreCase) < 0)
            {
                throw new ArgumentException(
                          "DeleteRange<TEntity> requires a WHERE clause, use DeleteAll<TEntity> to delete everything.");
            }

            var config = MicroCRUDConfig.Current;

            dialect = dialect ?? config.Dialect;

            var tableSchema = TableSchemaFactory.GetTableSchema(typeof(TEntity), dialect, config.SchemaFactory);
            var sql         = dialect.MakeDeleteRangeStatement(tableSchema, conditions);

            return(MakeCommandDefinition(sql, parameters, transaction, commandTimeout, cancellationToken));
        }