ICoreTable.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq.Expressions;
  6. namespace InABox.Core
  7. {
  8. public interface ICoreTable
  9. {
  10. IList<CoreColumn> Columns { get; }
  11. IList<CoreRow> Rows { get; }
  12. Dictionary<string, IList<Action<object, object>?>> Setters { get; }
  13. string TableName { get; set; }
  14. void CopyTo(CoreTable table);
  15. void CopyTo(DataTable table);
  16. IEnumerable<TValue> ExtractValues<TSource, TValue>(Expression<Func<TSource, TValue>> column, bool distinct = true);
  17. IEnumerable<TValue> ExtractValues<TValue>(string column, bool distinct = true);
  18. void Filter(Func<CoreRow, bool> predicate);
  19. void LoadColumns(Type T);
  20. void LoadDictionary<T, TKey, TValue>(Dictionary<TKey, TValue> dictionary, Expression<Func<T, TKey>> key, Expression<Func<T, TValue>> value);
  21. void LoadRow(CoreRow row, CoreRow from);
  22. void LoadRow(CoreRow row, object obj);
  23. void LoadRows(CoreRow[] rows);
  24. void LoadRows(IEnumerable<object> objects);
  25. CoreRow NewRow(bool populate = false);
  26. DataTable ToDataTable(string name = "");
  27. IDictionary ToDictionary(string keycol, string displaycol, string sortcol = "");
  28. IEnumerable<T> ToObjects<T>() where T : BaseObject, new();
  29. List<T> ToList<T>() where T : BaseObject, new();
  30. Dictionary<TKey, TValue> ToDictionary<T, TKey, TValue>(Expression<Func<T, TKey>> key, Expression<Func<T, TValue>> value,
  31. Expression<Func<T, object>>? sort = null);
  32. Dictionary<TKey, string> ToDictionary<T, TKey>(Expression<Func<T, TKey>> key, Expression<Func<T, object>>[] values,
  33. Expression<Func<T, object>>? sort = null);
  34. }
  35. }