Massive.DynamicModel.CreateDeleteCommand C# (CSharp) Method

CreateDeleteCommand() public method

Removes one or more records from the DB according to the passed-in WHERE
public CreateDeleteCommand ( string where = "", object key = null ) : DbCommand
where string
key object
return DbCommand
        public virtual DbCommand CreateDeleteCommand(string where = "", object key = null, params object[] args)
        {
            var sql = string.Format("DELETE FROM {0} ", TableName);
            if (key != null) {
                sql += string.Format("WHERE {0}=@0", PrimaryKeyField);
                args = new object[] { key };
            }
            else if (!string.IsNullOrEmpty(where)) {
                sql += where.Trim().StartsWith("where", StringComparison.OrdinalIgnoreCase) ? where : "WHERE " + where;
            }
            return CreateCommand(sql, null, args);
        }