Ejemplo n.º 1
0
        /// <summary>
        /// Dati due oggetti ritorna elenco differenze
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public DataDiffList Diff(T other)
        {
            Property oProp;
            object   oSource, oOther;

            //Se other null eccezione
            if (other == null)
            {
                throw new ObjectException(Resources.ObjectMessages.Diff_Null, this.mClassSchema.ClassName);
            }

            //Se other non e' dello stesso tipo
            if (this.mClassSchema.InternalID != other.mClassSchema.InternalID)
            {
                throw new ObjectException(Resources.ObjectMessages.Diff_WrongType, this.mClassSchema.ClassName, other.mClassSchema.ClassName);
            }

            DataDiffList oDiffList = new DataDiffList();

            for (int iPropIndex = 0; iPropIndex < this.mClassSchema.Properties.Count; iPropIndex++)
            {
                oProp   = this.mClassSchema.Properties[iPropIndex];
                oSource = this.GetProperty(iPropIndex);
                oOther  = other.GetProperty(iPropIndex);

                //Proprietà normale
                if (!object.Equals(oSource, oOther))
                {
                    DataDiff oDiff = new DataDiff(oProp.Name, ref oSource, ref oOther);
                    oDiffList.Add(oDiff);
                }
            }

            return(oDiffList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Verifica se due oggetti sono uguali in tutte le proprietà mappate su DB
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool EqualsDeep(T other)
        {
            DataDiffList oDiffList = this.Diff(other);

            return(oDiffList.Count == 0);
        }