IScannable.cs 810 B

1234567891011121314151617181920212223242526
  1. using InABox.Clients;
  2. using InABox.Core;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. namespace Comal.Classes
  8. {
  9. public interface IScannable
  10. {
  11. }
  12. public class ScannableLookups : LookupGenerator<object>
  13. {
  14. public ScannableLookups(object[] items) : base(items)
  15. {
  16. var classes = CoreUtils.Entities
  17. .Where(x => x.IsSubclassOf(typeof(Entity)) && x.HasInterface<IScannable>() && x.GetInterfaces().Contains(typeof(IPersistent)))
  18. .OrderBy(x => x.EntityName().Split('.').Last()).ToArray();
  19. foreach (var entity in classes)
  20. if (ClientFactory.IsSupported(entity))
  21. AddValue(entity.EntityName(), entity.EntityName().Split('.').Last());
  22. }
  23. }
  24. }