Esempio n. 1
0
        public void Delete <T>(string columnName, object columnValue) where T : RepositoryRecord <T>, new()
        {
            T item = new T();

            TableSchema.Table tbl = item.GetSchema();
            if (tbl.GetColumn(ReservedColumnName.DELETED) != null)
            {
                //create an update command
                new Update(tbl).Set(ReservedColumnName.DELETED).EqualTo(true).Where(columnName).IsEqualTo(columnValue).Execute();
            }
            else if (tbl.GetColumn(ReservedColumnName.IS_DELETED) != null)
            {
                new Update(tbl).Set(ReservedColumnName.IS_DELETED).EqualTo(true).Where(columnName).IsEqualTo(columnValue).Execute();
            }
            else
            {
                QueryCommand del = ActiveHelper <T> .GetDeleteCommand(columnName, columnValue);

                DataService.ExecuteQuery(del);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Returns a DELETE QueryCommand object to delete the records with
 /// matching passed column/value criteria
 /// </summary>
 /// <param name="columnName">Name of the column to match</param>
 /// <param name="oValue">Value of column to match</param>
 /// <returns></returns>
 public static QueryCommand GetDeleteCommand(string columnName, object oValue)
 {
     return(ActiveHelper <T> .GetDeleteCommand(columnName, oValue));
 }
Esempio n. 3
0
 /// <summary>
 /// Returns a DELETE QueryCommand object to delete the record with
 /// the primary key value matching the passed value
 /// </summary>
 /// <param name="keyID">The primary key record value to match for the delete</param>
 /// <returns></returns>
 public static QueryCommand GetDeleteCommand(object keyID)
 {
     return(ActiveHelper <T> .GetDeleteCommand(keyID));
 }