using System; using System.Data; using System.Collections; using BP.DA; using BP.En; namespace BP.Sys { /// /// 通用OID实体 /// public class GEEntityMyPK : Entity { #region 构造函数 /// /// 设置或者获取主键值. /// public string MyPK { get { return this.GetValStrByKey("MyPK"); } set { this.SetValByKey("MyPK", value); } } public void setMyPK(string val) { this.SetValByKey("MyPK", val); } /// /// 主键值 /// public override string PK { get { return "MyPK"; } } /// /// 主键字段 /// public override string PKField { get { return "MyPK"; } } /// /// 转化为类. /// /// public override string ToString() { return this.FrmID; } public override string ClassID { get { return this.FrmID; } } /// /// 主键 /// public string FrmID = null; /// /// 通用OID实体 /// public GEEntityMyPK() { } /// /// 通用OID实体 /// /// 节点ID public GEEntityMyPK(string frmID) { this.FrmID = frmID; } public GEEntityMyPK(string frmID, string pk) { this.FrmID = frmID; this.PKVal = pk; this.Retrieve(); } #endregion #region 构造映射. /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; if (this.FrmID == null) throw new Exception("没有给" + this.FrmID + "值,您不能获取它的Map。"); this._enMap = BP.Sys.MapData.GenerHisMap(this.FrmID); return this._enMap; } } /// /// GEEntityMyPKs /// public override Entities GetNewEntities { get { if (this.FrmID == null) return new GEEntityMyPKs(); return new GEEntityMyPKs(this.FrmID); } } #endregion } /// /// 通用OID实体s /// public class GEEntityMyPKs : Entities { #region 重载基类方法 public override string ToString() { //if (this.FrmID == null) // throw new Exception("@没有能 FK_MapData 给值。"); return this.FrmID; } /// /// 主键 /// public string FrmID = null; #endregion #region 方法 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { if (this.FrmID == null) return new GEEntityMyPK(); return new GEEntityMyPK(this.FrmID); } } /// /// 通用OID实体ID /// public GEEntityMyPKs() { } public GEEntityMyPKs(string frmID) { this.FrmID = frmID; } #endregion #region 为了适应自动翻译成java的需要,把实体转换成List. /// /// 转化成 java list,C#不能调用. /// /// List public System.Collections.Generic.IList ToJavaList() { return (System.Collections.Generic.IList)this; } /// /// 转化成list /// /// List public System.Collections.Generic.List Tolist() { System.Collections.Generic.List list = new System.Collections.Generic.List(); for (int i = 0; i < this.Count; i++) { list.Add((GEEntityMyPK)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }