public static BaseEntity CloneAll(BaseEntity SourceObj)
        {
            TableDef   td      = GetTableDef(SourceObj.GetType());
            BaseEntity DestObj = (BaseEntity)BaseFactory
                                 .CreateInstance(td._ClassType);

            IRuleInitUI px = DestObj as IRuleInitUI;

            //CallLoadRule = CallLoadRule && px != null;

            DestObj.EntityOnLoad = true;
            try
            {
                DestObj = SourceObj.ShallowClone();

                if (td.ChildEntities.Count > 0)
                {
                    foreach (EntityCollDef ecd in td.ChildEntities)
                    {
                        //IEntityCollection cols = (IEntityCollection)
                        //    Activator.CreateInstance(ecd.ConstructionType);
                        //if (ecd.mi.MemberType == MemberTypes.Field)
                        //    ((FieldInfo)ecd.mi).SetValue(DestObj, cols);
                        //else
                        //    ((PropertyInfo)ecd.mi).SetValue(DestObj, cols, null);

                        IList SrcCols  = ecd.GetValue(SourceObj);
                        IList DestCols = (IList)ecd.CreateNew((BusinessEntity)DestObj);

                        ((IEntityCollection)DestCols).OnLoad = true;
                        foreach (BusinessEntity obj in SrcCols)
                        {
                            DestCols.Add(CloneAll(obj));
                        }
                        ((IEntityCollection)DestCols).OnLoad = false;
                    }
                }

                //if (CallLoadRule)
                //{
                //    px.AfterLoadFound();
                //    BaseFramework.DoEntityAction(DestObj, enEntityActionMode.AfterLoadFound);
                //}
                ParentEntity pe = DestObj as ParentEntity;
                if (pe != null)
                {
                    pe.AfterClone((ParentEntity)SourceObj);
                }
            }
            finally
            {
                DestObj.EntityOnLoad = false;
                DestObj.DataChanged();
            }
            return(DestObj);
        }