CompareObjects() public method

public CompareObjects ( object currentObject, object previousObject ) : IEnumerable
currentObject object
previousObject object
return IEnumerable
        public bool IsFileAValidModification(IFileInfo file, IProject baseProject, IProject sourceProject, List<string> warnings, List<FileReleaseInfo> releases)
        {
            if (FileIsDeletedItem(file))
                return false;

            if (FileIsSharedResx(file))
            {
                var baseFile = baseProject.Drive.GetFileInfo(file.Url);
                var sourceFile = sourceProject.Drive.GetFileInfo(file.Url);
                ResxDifferences changes = ResxDiffMerge.CompareResxFiles(sourceFile, baseFile);
                if (changes.None)
                    return false;
            }

            if (FileIsRelationship(file))
            {
                Guid sourceId = GetModelItemIdFromFile(file);
                if (sourceId == Guid.Empty)
                    return true;

                OrmRelationship baseRelationship = FindRelationshipInBaseById(sourceId, baseProject);
                if (baseRelationship != null)
                {
                    var sourceRelationship = sourceProject.Get<OrmRelationship>(file.Url);
                    var diffMerge = new ObjectDiffMerge();
                    var changes = diffMerge.CompareObjects(sourceRelationship, baseRelationship);
                    if (!changes.All(change => RelationshipChangeCanBeIgnored(change)))
                        warnings.Add(string.Format("{0} is an existing SalesLogix relationship that was renamed and also modified.  This file will need to be manually merged.", file.Url));

                    return false;
                }
            }

            return true;
        }
        public bool IsFileAValidAddition(IFileInfo file, IProject baseProject, IProject sourceProject, List<string> warnings)
        {
            Guid sourceId = GetModelItemIdFromFile(file);
            if (sourceId == Guid.Empty)
                return true;

            OrmRelationship baseRelationship = FindRelationshipInBaseById(sourceId, baseProject);
            if (baseRelationship != null)
            {
                var sourceRelationship = sourceProject.Get<OrmRelationship>(file.Url);
                var diffMerge = new ObjectDiffMerge();
                var changes = diffMerge.CompareObjects(sourceRelationship, baseRelationship);
                if (!changes.All(change => RelationshipChangeCanBeIgnored(change)))
                    warnings.Add(string.Format("{0} is an existing SalesLogix relationship that was renamed and also modified.  This file will need to be manually merged.", file.Url));

                return false;
            }

            return true;
        }
        public void Test()
        {
            OrmRelationship prevRelationship, currentRelationship;
            var serializer = new XmlSerializer(typeof (OrmRelationship));
            using(var prevStream = System.IO.File.OpenRead(@"C:\Test\SLX_InternalBase\Model\Entity Model\Relationships\Account.ShippingId.ShippingAddress.ManyToOne.Address.AddressId.relationship.xml"))
            {
                prevRelationship = serializer.Deserialize(prevStream) as OrmRelationship;
            }
            using (var currentStream = System.IO.File.OpenRead(@"C:\Test\SLX_Internal\Model\Entity Model\Relationships\Account.Address.a6e41b881fab44f8b33d753230f30ef9.relationship.xml"))
            {
                currentRelationship = serializer.Deserialize(currentStream) as OrmRelationship;
            }

            var diffMerge = new ObjectDiffMerge();
            diffMerge.CompareObjects(currentRelationship, prevRelationship);
        }