第一章(1):Nettiers实体层,IEntity,EntityState

 
  1.         /// <summary>
  2.     /// List of possible state for an entity.
  3.     /// </summary>
  4.     ///实体状态定义
  5.         public enum EntityState
  6.     {
  7.         /// <summary>
  8.         /// Entity is unchanged
  9.         /// </summary>
  10.         Unchanged=0,
  11.         /// <summary>
  12.         /// Entity is new
  13.         /// </summary>
  14.         Added=1,
  15.         /// <summary>
  16.         /// Entity has been modified
  17.         /// </summary>
  18.         Changed=2,
  19.         /// <summary>
  20.         /// Entity has been deleted
  21.         /// </summary>
  22.         Deleted=3
  23.     }
  24.         /// <summary>
  25.         /// The interface that each business object of the model implements.
  26.         /// </summary>
  27.         public interface IEntity
  28.         {
  29.                 /// <summary>
  30.                 ///        The name of the underlying database table.表名
  31.                 /// </summary>
  32.                 string TableName { get;}
  33.                 /// <summary>
  34.                 ///        Indicates if the object has been modified from its original state.
  35.                 /// </summary>
  36.                 ///<value>True if object has been modified from its original state; otherwise False;</value>
  37.                 ///实体改变时为TRUE,否则为假
  38.                 bool IsDirty {get;}
  39.                 /// <summary>
  40.                 ///        Indicates if the object is new.
  41.                 /// </summary>
  42.                 ///<value>True if objectis new; otherwise False;</value>
  43.                 ///实体为新建时为TRUE
  44.                 bool IsNew {get;}
  45.                 /// <summary>
  46.                 /// True if object has been marked as deleted. ReadOnly.
  47.                 /// </summary>
  48.                 ///实体标记为DELETED时为TRUE
  49.                 bool IsDeleted {get;}
  50.                 /// <summary>
  51.                 /// Indicates if the object is in a valid state
  52.                 /// </summary>
  53.                 /// <value>True if object is valid; otherwise False.</value>
  54.                 ///校验有效时为TRUE
  55.                 bool IsValid { get;}
  56.                 /// <summary>
  57.                 /// Returns one of EntityState enum values - intended to replace IsNew, IsDirty, IsDeleted.
  58.                 /// </summary>
  59.                 //返回实体状态
  60.                 EntityState EntityState {get;}
  61.                 /// <summary>
  62.                 /// Accepts the changes made to this object by setting each flags to false.
  63.                 /// </summary>
  64.                 ///当手动实现保存方法后,通过acceptchange方法来修改对象的属性,状态改为未修改,还将副本清除
  65.                 void AcceptChanges();
  66.                 /// <summary>
  67.                 /// Marks entity to be deleted.
  68.                 /// </summary>
  69.                 ///标记实体为删除
  70.                 void MarkToDelete();
  71.                 /// <summary>
  72.         /// Gets or sets the parent collection.
  73.         /// </summary>
  74.         /// <value>The parent collection.</value>
  75.         ///取父实体
  76.                 object ParentCollection{get;set;}
  77.                 /// <summary>
  78.                 ///                The name of the underlying database table's columns.
  79.                 /// </summary>
  80.                 /// <value>A string array that holds the columns names.</value>
  81.                 ///取列名数组
  82.                 string[] TableColumns {get;}
  83.                 /// <summary>
  84.                 ///     Gets or sets the object that contains supplemental data about this object.
  85.                 /// </summary>
  86.                 /// <value>Object</value>
  87.                 ///实体的摘要内容
  88.                 object Tag { get;set;}
  89.                 /// <summary>
  90.       /// Event to indicate that a property has changed.
  91.       /// </summary>
  92.       ///实体属性改变事件
  93.                 event PropertyChangedEventHandler PropertyChanged;
  94.                 /// <summary>
  95.                 /// Determines whether this entity is being tracked.
  96.                 /// </summary>
  97.                 bool IsEntityTracked {        get;  set;        }
  98.                 ///<summary>
  99.                 /// The tracking key used to with the <see cref="EntityLocator" />
  100.                 ///</summary>
  101.                 string EntityTrackingKey {        get;  set;  }
  102.         }
  103.         /// <summary>
  104.         ///     Interface that TList and every entity implements to support
  105.         ///                cloning of an object tree.
  106.         /// </summary>
  107.         ///克隆扩展接口
  108.         public interface ICloneableEx
  109.         {
  110.                 ///<summary>
  111.                 /// The tracking key used to with the <see cref="EntityLocator" />
  112.                 ///</summary>
  113.                 ///<param name="existingCopies">A list containing references to all objects already copied.</param>
  114.                 object Clone(IDictionary existingCopies);
  115.         }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值