ICoreTable.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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; }
  14. void CopyTo(CoreTable table);
  15. void CopyTo(DataTable table);
  16. TValue[] ExtractValues<TSource, TValue>(Expression<Func<TSource, TValue>> column, bool distinct = true);
  17. 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 FillRow(CoreRow row, CoreRow from);
  22. void FillRow(CoreRow row, object obj);
  23. void LoadRows(IEnumerable<CoreRow> rows);
  24. void LoadRows(IEnumerable<object> objects);
  25. CoreRow NewRow(bool populate = false);
  26. DataTable ToDataTable(string name = "", IColumns? additionalColumns = null);
  27. IDictionary ToDictionary(string keycol, string displaycol, string sortcol = "");
  28. IEnumerable<T> ToObjects<T>() where T : BaseObject, new();
  29. Dictionary<TKey, TValue> ToDictionary<T, TKey, TValue>(Expression<Func<T, TKey>> key, Expression<Func<T, TValue>> value,
  30. Expression<Func<T, object>>? sort = null);
  31. Dictionary<TKey, string> ToDictionary<T, TKey>(Expression<Func<T, TKey>> key, Expression<Func<T, object>>[] values,
  32. Expression<Func<T, object>>? sort = null);
  33. }
  34. }