FieldNickGenerator.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Reflection;
  6. using HNWD.Pregrant.Model;
  7. namespace HNWD.Pregrant.DataAccess
  8. {
  9. public static class FieldNickGenerator<Entity> where Entity : ModelBase,new()
  10. {
  11. public static StringBuilder GeneratFieldNick()
  12. {
  13. StringBuilder sb = new StringBuilder(" ");
  14. //Type t = typeof(Entity);
  15. //foreach (FieldInfo p in t.GetFields())
  16. //{
  17. // IgnoreAttribute[] attr = (IgnoreAttribute[])p.GetCustomAttributes(typeof(IgnoreAttribute), true);
  18. // if(!(attr == null || attr.Length == 0))
  19. // {
  20. // continue;
  21. // }
  22. // NickAttribute[] attrs = (NickAttribute[])p.GetCustomAttributes(typeof(NickAttribute), true);
  23. // if (attrs == null || attrs.Length == 0)
  24. // {
  25. // sb.Append(p.Name + " , ");
  26. // }
  27. // else
  28. // {
  29. // sb.Append(p.Name + " as " + attrs[0].NickName + ", ");
  30. // }
  31. //}
  32. sb.Append(" * ");
  33. return sb;
  34. }
  35. }
  36. }