/// <summary> /// 复制对象 /// </summary> /// <returns></returns> public new ManyToSubClassType Clone() { ManyToSubClassType obj = new ManyToSubClassType(); obj.Property = Property; obj.ClassName = ClassName; obj.KindColumn = KindColumn; return(obj); }
private static void SetColumnValueFromSubClass(DataRow targetRow, object obj, PropertyInfo[] properties, ManyToSubClassType subObject) { object linkObj = GetPropertyValue(obj, properties, subObject.Property); if (linkObj != null) { SetDataRowValueFromObject(targetRow, linkObj); } }
private static void SetPropertyValueOfSubClass(object obj, PropertyInfo[] properties, DataRow sourceRow, ManyToSubClassType subObj) { // 使用类名或用工厂类取得实际的类名 string className; if (!String.IsNullOrEmpty(subObj.KindColumn)) { if (subObj.ClassName == "OrderContentFactory") { className = OrderContentFactory.GetOrderContentClassName(sourceRow[subObj.KindColumn]); } else { throw new ArgumentException(MessageStringManager.GetString("ClassNotImplement")); } } else { className = subObj.ClassName; } Object newObj = CreateAndIntializeObject(className, sourceRow); SetPropertyValue(obj, properties, newObj, subObj.Property); }