TableKey.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 
  2. //------------------------------------------------------------------------------
  3. // <auto-generated>
  4. // This code was generated from a template.
  5. //
  6. // Manual changes to this file may cause unexpected behavior in your application.
  7. // Manual changes to this file will be overwritten if the code is regenerated.
  8. // </auto-generated>
  9. //------------------------------------------------------------------------------
  10. using System.Collections.Generic;
  11. namespace EMIS.Entities.HRServices
  12. {
  13. public class TableKeyDictionary
  14. {
  15. private static Dictionary<string, string> items;
  16. public static Dictionary<string, string> Items
  17. {
  18. get { return items; }
  19. }
  20. static TableKeyDictionary()
  21. {
  22. items = new Dictionary<string, string>();
  23. items.Add("Comm_OrgInfo", "dpid");
  24. items.Add("Comm_Posts", "postid");
  25. items.Add("Comm_Users", "userid");
  26. }
  27. public static string GetKeyName<TEntity>(TEntity entity)
  28. {
  29. string tableName = entity.GetType().Name;
  30. return items[tableName];
  31. }
  32. public static string GetKeyName<TEntity>()
  33. {
  34. string tableName = typeof(TEntity).Name;
  35. return items[tableName];
  36. }
  37. }
  38. }