EntityConfig.cs 817 B

12345678910111213141516171819
  1. namespace TravelAgencyWinForms.Models;
  2. public sealed class EntityConfig
  3. {
  4. public string Title { get; init; } = string.Empty;
  5. public string TableName { get; init; } = string.Empty;
  6. public string? ViewName { get; init; }
  7. public string OrderBy { get; init; } = string.Empty;
  8. public bool ReadOnly { get; init; }
  9. public bool RestrictByCurrentEmployee { get; init; }
  10. public string? RestrictColumn { get; init; }
  11. public List<FieldConfig> Fields { get; init; } = new();
  12. public IEnumerable<FieldConfig> KeyFields => Fields.Where(f => f.IsKey);
  13. public IEnumerable<FieldConfig> GridFields => Fields.Where(f => f.ShowInGrid);
  14. public IEnumerable<FieldConfig> EditableFields => Fields.Where(f => !(f.IsKey && f.AutoIdentity));
  15. public string SourceName => ViewName ?? TableName;
  16. }