/// <summary>Tries to delete the datasets with the specified identifiers.</summary> /// <param name="table">The table.</param> /// <param name="ids">The identifiers.</param> /// <returns>The number of datasets removed, 0 if the database does not support deletion count or no dataset was removed.</returns> /// <typeparam name="TIdentifier">Identifier type. This has to be convertable to the database <see cref="DataType" />.</typeparam> public static int TryDelete <TIdentifier>(this ITable table, IEnumerable <TIdentifier> ids) { var idField = table.Layout.Where(f => f.Flags.HasFlag(FieldFlags.ID)).SingleOrDefault() ?? throw new InvalidOperationException("Could not find identifier field!"); return(table.TryDelete(Search.FieldIn(idField.Name, ids))); }
/// <inheritdoc /> public IList <TStruct> GetStructs(IEnumerable <TKey> ids) => GetRows(Search.FieldIn(KeyField.Name, ids)).Select(r => r.GetStruct <TStruct>(Layout)).ToList();
/// <inheritdoc /> public IList <Row> GetRows(IEnumerable <TKey> ids) => BaseTable.GetRows(Search.FieldIn(KeyField.Name, ids));
/// <inheritdoc /> public void Delete(IEnumerable <TKey> ids) => BaseTable.TryDelete(Search.FieldIn(KeyField.Name, ids));