BaseEntityObj.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using Ant.Entity;
  2. using Ant.Frame;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. namespace Ant.ORM
  9. {
  10. public abstract class BaseEntityObj
  11. {
  12. /// <summary>
  13. /// 时间戳
  14. /// </summary>
  15. internal long TimeStamp
  16. {
  17. get;
  18. }
  19. //private readonly Dictionary<string, EntityValue> _Values = new Dictionary<string, EntityValue>();
  20. ///// <summary>
  21. ///// 改变状态值属性
  22. ///// </summary>
  23. //[JsonIgnore, NotMapped]
  24. //public Dictionary<string, EntityValue> Values
  25. //{
  26. // get; set;
  27. //}
  28. private EntityPersistType persistType;
  29. /// <summary>
  30. /// 操作类型
  31. /// </summary>
  32. [JsonIgnore, NotMapped]
  33. public EntityPersistType PersistType
  34. {
  35. get { return persistType; }
  36. set { persistType = value; }
  37. }
  38. ///// <summary>
  39. ///// 给实体赋值
  40. ///// </summary>
  41. ///// <param name="FieldName">字段名称</param>
  42. ///// <param name="defaultValue">默认值</param>
  43. //protected void SetChanaged(string FieldName, object defaultValue)
  44. //{
  45. // if (Values.IsNull())
  46. // Values = new Dictionary<string, EntityValue>();
  47. // if (_Values.ContainsKey(FieldName))
  48. // {
  49. // EntityValue val = _Values[FieldName];
  50. // if (object.Equals(val.OriginalValue, defaultValue))
  51. // {
  52. // val.CurrentValue = null;
  53. // val.IsChanage = false;
  54. // }
  55. // else
  56. // {
  57. // val.CurrentValue = defaultValue;
  58. // val.IsChanage = true;
  59. // Values.Add(FieldName, val);
  60. // }
  61. // }
  62. // else
  63. // {
  64. // EntityValue val = new EntityValue();
  65. // val.OriginalValue = defaultValue;
  66. // val.FieldName = FieldName;
  67. // val.IsChanage = false;
  68. // _Values.Add(FieldName, val);
  69. // }
  70. //}
  71. }
  72. }