//---------------------------------------------------------- public virtual void Assign(TMetaEntity me, CEntity rhs) { TMetaTable mt = me.MetaTable; TInheritMappingType inheritType = mt.InheritMappingType; TMetaColumnCollection mcs = null; if (inheritType == TInheritMappingType.TablePerConcreteClass) { mcs = mt.FullValueColumns; } else if (inheritType == TInheritMappingType.TablePerSubClass) { mcs = mt.ValueColumns; } CEntity that = rhs as CEntity; foreach (TMetaColumn mc in mcs) { //if (!cm.IsAssign) // continue; if (mc.MemberName == "Captions.Cn (Assign)") { System.Diagnostics.Debug.WriteLine(mc.MemberName); } object v2 = that.GetEpoPropertyValue(mc); this.SetEpoPorpertyValue(mc, v2); } }
//-------------------------------------------------------------- public bool Equals(Type t, object rhs) { if (rhs == null) { return(false); } if (object.ReferenceEquals(this, rhs)) { return(true); } if (this.GetType() != rhs.GetType()) { return(false); } CEntity that = rhs as CEntity; if (that == null) { return(false); } TMetaEntity meta = TMetaRegistry.Default.GetMeta(t); TMetaTable mt = meta.MetaTable; TInheritMappingType inheritType = mt.InheritMappingType; TMetaColumnCollection mcs = null; if (inheritType == TInheritMappingType.TablePerConcreteClass) { mcs = mt.FullValueColumns; } else if (inheritType == TInheritMappingType.TablePerSubClass) { mcs = mt.ValueColumns; } bool b = true; foreach (TMetaColumn mc in mcs) { //if (!cm.IsCompare) // continue; if (mc.MemberName == "Captions.Cn (Equal)") { System.Diagnostics.Debug.WriteLine(mc.MemberName); } object v1 = this.GetEpoPropertyValue(mc); object v2 = that.GetEpoPropertyValue(mc); b = b && (object.Equals(v1, v2)); } b = b && (PersistState == that.PersistState); return(b); }
//---------------------------------------------------------- public override void Assign(object rhs) { CEntity that = rhs as CEntity; TMetaEntity meta = GetMetaEntity(this.GetType()); foreach (TMetaColumn mc in meta.MetaTable.FullValueColumns) { //if (mc.ColumnName == "CAPTIONS_CN") // System.Diagnostics.Debug.WriteLine(mc.ColumnName); object v = that.GetEpoPropertyValue(mc); this.SetEpoPorpertyValue(mc, v); } }
//-------------------------------------------------------------- // TODO: Distinguish between Equals/Equal public override bool Equals(object rhs) { if (rhs == null) { return(false); } if (object.ReferenceEquals(this, rhs)) { return(true); } if (this.GetType() != rhs.GetType()) { return(false); } CEntity that = rhs as CEntity; if (that == null) { return(false); } TMetaEntity me = GetMetaEntity(this.GetType()); if (me == null) { return(base.Equals(rhs)); } bool b = true; foreach (TMetaColumn mc in me.MetaTable.FullValueColumns) { //if (!cm.IsCompare) // continue; object v1 = this.GetEpoPropertyValue(mc); object v2 = that.GetEpoPropertyValue(mc); b = b && (object.Equals(v1, v2)); } //b = b && (PersistState == that.PersistState); return(b); }