You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuFieldDbo.cs 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using Luticate2.Auth.Business.Fields;
  6. namespace Luticate2.Auth.Dbo.Fields
  7. {
  8. public class LuFieldDbo
  9. {
  10. public IList<string> Parts { get; set; } = new List<string>();
  11. public static LuFieldDbo Make(IEnumerable<string> parts)
  12. {
  13. var partialFieldpath = new LuFieldDbo();
  14. return partialFieldpath.Add(parts);
  15. }
  16. public static LuFieldDbo Make(string path)
  17. {
  18. var partialFieldpath = new LuFieldDbo();
  19. return partialFieldpath.Add(path);
  20. }
  21. public static LuFieldDbo Make(LuFieldDbo path)
  22. {
  23. var partialFieldpath = new LuFieldDbo();
  24. return partialFieldpath.Add(path);
  25. }
  26. public static LuFieldDbo Make<TTypeTo>(Expression<Func<TTypeTo, object>> property)
  27. {
  28. var partialFieldpath = new LuFieldDbo();
  29. return partialFieldpath.Add(property);
  30. }
  31. public LuFieldDbo Copy()
  32. {
  33. return new LuFieldDbo
  34. {
  35. Parts = Parts.ToList()
  36. };
  37. }
  38. public override string ToString()
  39. {
  40. return string.Join("/", Parts);
  41. }
  42. }
  43. }